lua-users home
lua-l archive

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


On Mon, 26 Sep 2005 11:38:46 -0500 Rici Lake <lua@ricilake.net> wrote:

> This idiom is independent of inclusion in a looping construct.

Can't resist.  Sorry. :-)

My example 'continue' using repeat ... until true 'misused' that looping
construct, turning it into a simple block by making the iteration control
conditional superfluous.

A block, and I'm using the term in a somewhat broader sense than the
current Lua meaning,  is a scope range for local variables.  When Roberto
mentioned that the first iteration of the continue patch should do the
same sort of cleanup as 'break' does (for the 'nested' blocks that are
exited when the continue 'goto's the conditional evaluation), the
'environment frame' that is part of a block is part of that cleanup.

The special cases about what's in an 'environment frame' for a block when
it has a conditional attached have created a surprise.  This surprise
suggests to me that the 'block' as a construct should be 'promoted' and
reconsidered independently of the looping control conditional constructs
 with which it's usually very closely associated.

The aspect of Lua that really sets it apart from other languages for me
is that it and its syntax revolve around manipulating a few carefully
selected and useful computing constructs.  The 'block' may be one of those
constructs.

Perhaps (easy to suggest, harder to do!) looking further than the
particular case of 'continue' would lead to a general solution that would
give unsurprising implementations of <gotoblockXXXend> (break),
<gotoblockXXXbegin>(redo?) and
<gotoloopingconstructXXXconditionalevaluation> (continue).  I'll save my
campaign for 'redo' for another day. :-)


Lua is unique, and I have noticed that the keywords in Lua have
differences in  meaning from in other languages due to Lua's nature.  So,
I also wonder what motivated the change in repeat ... until ... .   That
is, what new use or better use of repeat ... until ... was envisioned that
this change was to make possible?

--
jrs