On 26.01.2009, at 20:58, Mark Engelberg wrote:

> On Mon, Jan 26, 2009 at 4:38 AM, Rich Hickey <[email protected]>  
> wrote:
>> Continuations, like TCO, will have to come from the JVM.
>
> Perhaps a better question to ask is whether it is possible to
> implement yield without user-available continuations.  I assume it's
> possible since Python has yield, but not continuations, however, I've
> never really given the issue much thought.

Python implements generators in its virtual machine through a  
mechanism which is pretty similar to what it takes to implement  
continuations. Its designer simply decided not to make continuations  
available to the programmer, but generators. I remember vaguely  
having seen an implementation of continuations in terms of Python  
generators, so the two seem to be equivalent.

> I agree that yield is the most handy way I know of to write  
> generators, so if it is possible to
> do this in Clojure, I think it would add quite a bit of value to  
> streams.

It is certainly possible, the question is just with how much effort  
and accpeting which limitations. As Paul Graham shows in "On Lisp",  
continuations can be implemented in Lisp (and thus very probably in  
Clojure) using a handful of not-quite-trivial macros. However, there  
are limitations on which functions continuation-using code may use,  
and there are performance issues as well.

Konrad.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to