[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lua-l
Subject:    Re: LuaJIT and Lua 5.2?
From:       David Given <dg () cowlark ! com>
Date:       2012-01-31 20:50:44
Message-ID: 4F285424.7090106 () cowlark ! com
[Download RAW message or body]


On 31/01/12 20:23, Francesco Abbate wrote:
[...]
> > Gotos are also useful for code generation, particularly if one has
> > some kind of #line pragma as well.
> 
> I'm sorry but I don't agree on this point. Adding a bad feature like
> goto to facilitate automatic code generation, this is a bad argument.

Speaking as somebody who writes code generators a lot, if you don't have
goto, you are *stuffed*. As far as I can tell it is simply not possible
to flatten an arbitrary control flow graph to runnable code without goto
[*]. The common control-flow structures in most languages --- while,
do-while, if-then-else etc --- can't do it without storing extra state
in a variable. The end result is that trying to translate code from a
language which supports arbitrary control flow graphs to a language
which doesn't becomes non-trivial.



[*] I am, of course, including tail calls as a form of sanitised goto.
But they're tough to use and can affect performance quite badly. Not as
badly as faking a state machine using variables, of course.

-- 
┌─── dg cowlark.com ───── \
http://www.cowlark.com ───── │
│ "Never attribute to malice what can be adequately explained by
│ stupidity." --- Nick Diamos (Hanlon's Razor)


["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic