[Prev][Next][Index][Thread]
Re: Dylan Features
In article <bruce-CB7CB7.10240205082000@news.akl.ihug.co.nz>, Bruce Hoult
<bruce@hoult.org> wrote:
>In article <398ACAE5.45966287@lotus.com>, Enter your Notes name here
><firstname_lastname@lotus.com> wrote:
>> Also, does Dylan have something like Scheme's
>> call-with-current-continuation? Thanks!
>
> Dylan doesn't have call-with-current-continuation. A lot of the things
> people build using call-with-current-continuation are instead built into
> Dylan e.g. exceptions, multiple value return. Coroutines would be the
> main other one, and I think should probably be required by the Dylan
> spec, but they aren't.
>
> -- Bruce
but we have the block macro that provides an exit function:
define function invoke(f :: <function>)
f(42*42)
end;
block(return)
invoke(return);
42
end block;
will evaluate to 42*42. (too lazy to compute it :-)
In this respect it is similar to call/cc:
(define (invoke f)
(f (* 42 42))
)
(define (block)
(call/cc invoke)
42
)
OTOH Dylan do not give you "invard" invocations of captured continuations,
so invoking "return" outside of the body of the block macro is undefined
behaviour. This would work in scheme.
Gabor
Follow-Ups:
References: