Hi Alex,

>    (setq x st1)
>    (setq x~sym1 5)
>    (print sym1 x~sym1 st1~sym1) # => NIL 5 5

great, it does what I was after!

>> How can I create a new empty symbol table?
>
> This is easy. Just initialize it with an empty cons pair:
>
>    (setq st1 (cons))
>
> However, I just didn't want to support this on the API level (in the
> 'syntax' function), because this is a very dangerous operation. If you
> should happen to set such an empty namespace to "current", you are
> lost, as no symbol at all will be accessible any longer. You have no
> other choice than to enter Ctrl-D ;-)

Good point.

>> How do I refer to a symbol table without making it the default one?
>
> Just the normal way, as a symbol. You can manipulate namespaces
> manually any way you like, as they are simply pairs of 'idx' trees.

OK.  I think the difference from traditional approach in other languages
is that the namespace must be "visible" in the current namespace.

> I don't see any problem. Here how this could be done (note that I use
> the convention to save and restore the current namespace in each
> module.  This allows to load each module in arbitrary contexts):

Yes, I was pointing out a problem to avoid which is not an issue with
your implementation:-D

Also, as we discussed on IRC, it would be nice to have the namespace
name displayed in the repl prompt, e.g. via customizable prompt
function as you suggested.

Cheers,

Tomas
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to