lua-users home
lua-l archive

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


On Tue, 12 Jan 2010, steve donovan wrote:
> On Tue, Jan 12, 2010 at 7:04 PM, Tony Finch <dot@dotat.at> wrote:
> >
> > It occurred to me that a nice way to express the hook after a lexical
> > block might be as follows, somewhat inspired by for loop iterators.
> >
> >        in env, hook do
> >                block
> >        end
>
> This would be easier than yet-another-metamethod-on-env, I must say.
> Although, the hook parameter would be optional, so 'in env do...end'
> remains (and people need never know that there are block hooks)

Yes, I said the hook is optional.

> Although checking block exit could slow down this construct, which is
> often going to be used as a convenient multiple-field assignment with
> tables.

"in" blocks do not work as a multiple assignment.

Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
GERMAN BIGHT HUMBER: SOUTHWEST 5 TO 7. MODERATE OR ROUGH. SQUALLY SHOWERS.
MODERATE OR GOOD.