Page 1 of 1
load default functor Token-char:Token-char failed.
Posted: Thu Jun 12, 2014 3:33 am
by ssqq
I meet a strange problem:
When I load the module with content below:
Code: Select all
(define Token-char:Token-char)
(Token-char "key" 123)
REPL output:
ERR: context expected in function define : Token-char
When I use other context name like:
Code: Select all
(define Token:Token)
(Token "key" 123)
That is ok.
If have any reserved context name in newLISP?
Re: load default functor Token-char:Token-char failed.
Posted: Thu Jun 12, 2014 1:44 pm
by Lutz
Most likely
Token-char was used before as a simple variable / symbols in the same newLISP session. Then when creating the defaut functor with
(define Token-char:Token-char) the error is thrown. The error message protects you against programming errors.
Only the
context function can convert normal symbols to context symbols. But if trying to use the context symbols after that as a normal variable you would get an error that the symbol is protected.
To see any symbols already defined execute
symbols. As it is good programming practice to start context names with an upper-case letter, they will be high up in the list, preceded by system owned symbols starting with
$. More about these here:
http://www.newlisp.org/downloads/newlis ... em_symbols
Re: load default functor Token-char:Token-char failed.
Posted: Thu Jun 12, 2014 2:31 pm
by rickyboy
Lutz wrote:Most likely Token-char was used before as a simple variable / symbols in the same newLISP session.
Yes, because if you try doing this in a clean session, you'll get no errors.
Code: Select all
~ $ newlisp
newLISP v.10.5.8 32-bit on Win32 IPv4/6 libffi, options: newlisp -h
> (define Token-char:Token-char)
nil
> (Token-char "key" 123)
123
>