guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Non-stack-copying call-with-current-continuation?


From: David Kastrup
Subject: Re: Non-stack-copying call-with-current-continuation?
Date: Mon, 05 Mar 2012 00:13:29 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

Mark H Weaver <address@hidden> writes:

> David Kastrup <address@hidden> writes:
>
>> Andy Wingo <address@hidden> writes:
>>
>>> On Sun 04 Mar 2012 13:01, David Kastrup <address@hidden> writes:
>>>
>>>> The global symbol space is a different identity space than heap
>>>> equality, and it never gets garbage collected: the lifetime of a
>>>> gensym is eternal.
>>>
>>> This is not true in Guile, where symbols can be garbage collected.
>>
>> The symbol name is not garbage collected.  That is the difference
>> between gensym and make-symbol.
>
> Integers are plentiful and cheap.

We are not talking about an integer generated statically here.  We are
talking about integers getting burned through every time a control
structure is being used.  Not at compilation time, but at runtime.  And
with today's computers, executing a loop often enough that the integers
don't fit into a single Scheme cell anymore and stop being cheap is not
really an extraordinary event.

> Anyway, there's a well-known "Efficient Gensym Hack" where gensyms are
> given names lazily.  We haven't yet implemented that in Guile, but I
> hope to add it before 2.2.  With that optimization, if you never ask
> for the name of a gensym (e.g. by printing it) then it is never
> assigned a name or even a number.

That would help.

> Also, in Guile 2, prompt tags need not be symbols.  Anything that can
> be compared with 'eq?' will work.

I suppose there is no compelling technical reason why this could not be
made to also work with catch/throw, right?  Being able to use something
like (list #f) instead of gensym would seriously reduce the cost, both
felt as well as actual.

-- 
David Kastrup




reply via email to

[Prev in Thread] Current Thread [Next in Thread]