[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Assignment in functional conditionals, any alternative?
- From: "Dr. Rich Artym" <rartym@...>
- Date: Tue, 6 May 2003 15:21:20 +0100
Thank you all for the informative answers. I chased down through the
key points and understood most of them, thanks. I'm trying to figure
out the rest before asking more questions.
To summarize, there is apparently no good and lightweight way to turn
an assignment into the <expr> located in "while <expr> do .... done".
My functional form which both defined and applied a function within the
<expr> term failed miserably on poor scoping and unnecessary and costly
redefinitions, and there would appear to be no way of curing its ills
in situ, and even less chance of doing it efficiently.
No problem, "Live with what you've got" as they say, and so now I'm
exploring the various structurally different alternatives given by Wim,
Joe and Rici. They each have interesting aspects too, and maybe one
day Wim's old crusade to make all statements be expressions might bear
fruit, who knows. :-)
PS. Wim's suggestion would give Lua's expressive power a major boost,
but as he hinted, it has some sharp corners and might be difficult to
do. Merely encapsulating assignment is hugely weaker than that, but
is comparatively trivial in that it would just add another disjoint
term to the syntax of <expr> without any combinatorial explosion in
the grammar, and code generation would seem to involve preserving a
value that is currently thrown away. At least from the perspective
of a Lua newbie, in which all is roses. :-)))
Cheers all,
Rich Artym.
--
Existing media are so disconnected from reality that our policy debates
spin around a fantasy world in which the future looks far too much like
the past. http://www.zyvex.com/nanotech/MITtecRvwSmlWrld/article.html