On Wed, Apr 13, 2011 at 2:15 PM, Alexander Burger <a...@software-lab.de> wrote:
> Hi Edwin,
>
>> if i understand correctly, (====) when called outside a method works
>> only when a file is (load)ed?
>
> I'm not sure what you mean here. Isn't that the case for _any_ function?

check. i realized this after sending my first email.

>
> To my understanding '====' is a normal function, which clears the
> transient symbol table as a side effect.

right. again, more insight.

only the transient table is cleared, but the transient symbols
themselves are left alone.

additionally, the reference says:

That means, a transient symbol cannot be accessed then by its name,
and there may be several transient symbols in the system having the
same name.

i had a hard time understanding this until i checked the source, which
just wipes out the transient hash table but leaves the heap alone.

>
>
>
>> replying to myself, wrote a test...
>>
>> (de test1 ()
>>    (if (not (num? "ctr"))
>>       (setq "ctr" 1)
>>       (inc '"ctr")
>>    )
>>    (prinl "ctr")
>>    (====)
>> )
>>
>> (test1)
>> (test1)
>> (prinl "ctr")
>>
>> did a face palm and tells myself "that's how a static behaves in C!".
>> did that explain that right?
>
> Yes, exactly.
>
> 'test1' will always refer to "ctr", even if it is gone out of visibility
> (transient scope) for the outside world.
>

after writing the test (damn, i should be writing more tests rather
than asking...), reading the C code and reading and re-reading the
reference i now have a clearer picture of how transient symbols are
used. this is just part of unlearning  i think.

elegance!

thank you Alex for sharing all of this.

(wishful thinking: alternative syntax for representing transient
symbols without embedded spaces. maybe something like \xxx)

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

Reply via email to