Hi Ana,

> then there are transient symbols. from the reference, they're used as
> 'string literals' and can contain funky characters.
> ...
> re-reading the reference, transient symbols are also used for some
> scope stuff. i want to find out the specifics of this if its written

Yes. In fact, this "scope stuff" is perhaps the main purpose of
transient symbols.


> 1) what's the lifecycle of the transient symbol in the picolisp interpreter?

It is a lexical scope, extending the current 'load' environment which is
typically a source file. Thus, a given name refers to the same physical
transient symbol as long as the currently interpreted file (with 'load')
is active (and not interrupted by another 'load' or the '===='
function).


> 2) what other non obvious uses does the transient symbol fill?

None that I can think of at the moment. They are symbols just like
internal and external symbols, having a value, a property list and a
name (all three of them are optional).


> anywhere, please point me to it. (btw, Alex, the documentation is
> great. i'm still on the learning curve).
> 
> "The interpreter recognizes external symbols internally by an
> additional tag bit in the tail structure. ". where is the tag bit
> implemented? in the C interpreter or picolisp?

It is in the lowest data structions on the C or asm level. It is
documentd in most detail for the 64-bit version in "doc64/structures".
The name of an external symbols is shown in line 96.

   xx.xxxxxxxxx.xxxxxxx.xxxxxxxxxxx.xxxxxxx.xxxxxxxxxxxxxxxxxxxE010
     obj       file    obj         file    obj

where the 'E' is the above tag bit. Other symbols (in line 78) have a
zero bit there.


> 3) i was digging in the code and saw transient symbols being used as
> function names. why so?

This can be useful to "hide" a function from the external world.


> 4) as far as i can tell, external symbols are just plain symbols
> (transient, i think) with a special naming scheme. is this right?

They are a little more than internal and transient symbols.

Yes: They have a special naming scheme. Their name identifies their
location in the database file, and cannot be made up by the programmer
as in the case of other symbols. That is, the name is implicitly
generated when the symbol is created (with 'new').


> > 5) is there any special treatment in the interpreter for external
> > symbols? (because i can't find any so far).

Yes, there are two important differences:

1. When the interpreter wants to access an external symbol's value or
   property list, and finds it is not yet in memory, it will fetch it
   from the database file.

2. The symbol will not be automatically garbage-collected as long as it
   is "dirty" (modified) and not yet written to the file (via 'commit').

Did I forget something?

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to