[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (beta-rc1) now available
- From: David Kastrup <dak@...>
- Date: Wed, 15 Jun 2011 11:04:14 +0200
"Joseph Manning" <manning@cs.ucc.ie> writes:
> On 2011-Jun-15 (Wed) at 00:59 (-0400), phlnc8 wrote:
>
>>> On Mon, Jun 13, 2011 at 4:27 PM, Alexandre Erwin Ittner
>>> <alexandre@ittner.com.br> wrote:
>>> ...
>>> > A "label" keyword would be great too
>>>
>>> I like this idea of a "label" reserved word.
>
> +1
There has been some notion of making coroutines callable like
subroutines, more or less making coroutine.wrap a one-shot operation for
setting up a coroutine. It would be nice if labels were callable in a
similar way. However, a function or coroutine can be put into a
variable, calling the variable later, and that does not appear to work
reasonably well for forward jumps. One could possibly work with forward
declarations:
xxx = label zzz
[...]
xxx() -- jumps forward
[...]
(label zzz)() -- jumps forward
[...]
label zzz
[...]
zzz() -- jumps backwards
The next obvious extension is arguments. Soon we are at Scheme's named
let and then at continuations.
Of course, one should try figuring out where to draw a sensible line
that does not sacrifice comprehensibility for elegance. But I think it
reasonable to try finding a way where the flow control transfers of
resuming a thread, calling a function, and jumping to a label are all
wrapped into a suitably uniform syntax.
--
David Kastrup