lua-users home
lua-l archive

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


On Tue, Jan 12, 2010 at 3:20 PM, steve donovan
<steve.j.donovan@gmail.com> 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)
>
> Although checking block exit could slow down this construct, which is
> often going to be used as a convenient multiple-field assignment with
> tables.

What is the expected behavior when an error occurs inside the block?
The hook should be called or not?