[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 Given <dg@...>
- Date: Tue, 14 Jun 2011 11:35:31 +0100
steve donovan wrote:
> On Mon, Jun 13, 2011 at 9:51 PM, Petite Abeille
> <petite.abeille@gmail.com> wrote:
>> Goto? Really? How quaint :P
>
> Seriously, very useful sometimes. Even the person who hammered
> structured programming into me using Pascal (Judy Bishop) accepted
> that a goto could be used without committing a sin.
Hell yeah. I'm really happy to see this, it's something I've been
wanting in Lua for ages...
> Also, interesting possibilities for code generation.
...primarily for this reason. Trying to flatten a basic block graph into
runnable code when all you have are if...then...else, while...,
repeat...until etc is *really hard*, and I believe (though I haven't
seen proof) is actually impossible in the general case. Having actual
goto available makes life so much easier.
I assume that goto labels exist in their own namespace and are scoped
alongside locals; but the necessity for forward references does make
life more complicated. e.g.:
@label: -- 0
do
goto label
do
@label: -- 1
end
@label: -- 2
end
Does the goto jump to 0, 1, 2, or is this a compilation error?
--
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│ "I have always wished for my computer to be as easy to use as my
│ telephone; my wish has come true because I can no longer figure out
│ how to use my telephone." --- Bjarne Stroustrup
Attachment:
signature.asc
Description: OpenPGP digital signature