lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 24/01/11 06:46, steve donovan wrote:
[...]
> Imagine trying to get 'goto' into a modern dynamic language this late
> in the computer century ....

Yeah, it's a problem. Alas, most languages used these days were
developed during a period when it was considered fashionable to be
rabidly anti-goto (mostly due to misunderstanding what Dijkstra was on
about in his famous letter), and so don't have any facility for
constructing arbitrary shapes of program graph. This is thankfully
fading a little these days, but it's still around.

As a result, in most dynamic languages these days it is utterly
impossible to construct some programs without using hacks involving
program state, so crippling performance. Doing some measurements with
Clue and a hacked Lua interpreter showed that being able to use
arbitrary program branching would improve performance by 30%.

(In fact, I'm toying with an idea for using closures and tail calls in
Lua to get around this --- but it *still* won't be as fast as goto code,
and will cause memory usage to explode. And, of course, it doesn't help
the other languages.)

(I will also admit that while I'm pretty sure that arbitrary program
graphs can't be replicated using structured programming techniques, I
have not yet found a proof as such. If anyone can point me at an
algorithm for decomposing a program graph into a set of structured
programming directives *that works in every possible case* I would be
incredibly grateful.)

[...]
> One could add @line directives to Lua with a token filter, but I also
> doubt that the token filter patch will ever make mainstream, for
> similar reasons to 'goto'.

Interestingly enough, the absence of a @line directive in Lua is
crippling Objective Lua's ability to be useful. If I could emit the
generated source in a different order to the input source, I could use a
vastly more efficient object model. But as it is, I can't, and I have to
jump through many hoops (including having to enforce certain syntactical
rules!) simply in order to get the debugging information correct.

-- 
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│
│ "I have a mind like a steel trap. It's rusty and full of dead mice."
│ --- Anonymous, on rasfc

Attachment: signature.asc
Description: OpenPGP digital signature