Hi Alex,

>> The question is: What is the "correct" way?

I am writing my own sexp reader which is safe against malicious input,
i.e. it does not call eval (the escape chars like ` are not
understood).

>>    : (intern "123")
>>    -> 123
>>    : (+ @ 7)       
>>    123 -- Number expected

I thought I could use (intern (till " ^I^M^J()\"" T)) to read in atoms
but obviously it's not possible because intern does not understand
numbers.  'any' seems to be using the picolisp reader so I cannot use
that:

: (intern "12`+453")
-> 12\`+453
: (any "12`+453")
-> 12

is not the same.

Looks I need to make more effort and determine the type of the atom
before feeding it to 'intern' or 'format'.

> In general, 'intern' should do what it is supposed to do, and intern
> a symbol. When the user chooses to intern a symbol with a strange
> name like "123" it is his choice.

I suppose that's reasonable.

Thank you,

Tomas
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to