Continuations and generators

Slava Pestov — 2004-06-08 06:21:02

Chris,

I think your generator library should be included with Factor; what do
you think? Your code is nicely written. You're certainly making more use
of continuations than I do :)

Two minor style notes; your definitions are maybe a tad too long. Also,
can you please use the documentation comment syntax:

: some-word ( ... )
#! docs...
#! more docs...
... ;

That way, the comments will be visible when the word definition is
inspected in the interpreter using "see".

Perhaps we could use a name other than 'yield'. My game library already
contains a word 'yield', with a different meaning. While vocabularies
will prevent the two names from clashing, it could still get confusing :)

Slava

PS: I forgot to incorporate tree-each in 0.59. It will be in the next
release.

Chris Double — 2004-06-13 02:34:43

On Tue, 08 Jun 2004 02:21:02 -0400, "Slava Pestov" <slava@...>
said:
> I think your generator library should be included with Factor; what do
> you think? Your code is nicely written. You're certainly making more use
> of continuations than I do :)

Sure, if you want to include it that's fine with me. Continuations
combined with a Forth/Joy like language is an interesting combination and
is the area I'm playing with the most at the moment. Also my main job is
maintaining a continuation based web application server in Scheme so it
interests me to compare the approaches of the two languages. I suspect
that because continuations can't be compiled that some of the things I'm
doing won't be very efficient or the best way of doing things though.

> Two minor style notes; your definitions are maybe a tad too long. Also,
> can you please use the documentation comment syntax:

Sure, I'll change the code. The funny thing is, although I have long
definitions, I write them piece by piece and test each bit then combine
them into the one definition! I need to come up with names and keep the
smaller pieces around. I marvel at the nicely factored code in the Factor
source code and in the Joy examples on the Joy website.

> Perhaps we could use a name other than 'yield'. My game library already
> contains a word 'yield', with a different meaning. While vocabularies
> will prevent the two names from clashing, it could still get confusing :)

"suspend" is a common name for this. Or maybe gen-yield?

Chris.
--
Chris Double
chris.double@...