On Friday, August 8, 2003, at 12:07 AM, Jim Weirich wrote:
> Ahh, that's where the confusion is! Callcc doesn't stand for "call
> continuation". It is short for "call with current continuation". In
> other words, it calls a function passing in the current continuation.
I actually understood that -- I just found it confusing. Offhand, I
can't think of other Ruby classes that don't have a constructor, and
can only be created by a method in an unrelated class or module.
Besides, it doesn't precisely call a function passing the current
continuation, it yields to a block, passing in the current
continuation, if I understand things.
> Actually, to me it seems that the Continuation.new syntax is the one
> that is deceptive. For callcc doesn't create a NEW continuation, it
> just makes the existing continuation for the block available. All
> function calls have a continuation (its the code that is executed when
> the function returns). Callcc just makes that already existing
> continuation available.
Right, but I'd argue that it is creating a "Continuation". An object
of that class is being created, one which encapsulates the appropriate
state when callcc is used. It's true that an abstract continuation is
created behind the scenes whenever a function is called, it's just that
that process is internal to the interpreter, and not available to
programs.
I don't think that Continuation.new is deceptive in how it acts,
although it is somewhat deceptive in how it is implemented.
Do you have any suggestions on how to improve my Continuation add-ons,
or are you happy with just using callcc?
Ben