[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Lua 5.2.0 (beta-rc1) now available
- From: Jerome Vuarand <jerome.vuarand@...>
- Date: Tue, 14 Jun 2011 15:15:46 +0200
2011/6/14 Dirk Laurie <firstname.lastname@example.org>:
> On Tue, Jun 14, 2011 at 03:05:24PM +0200, Jerome Vuarand wrote:
>> 2011/6/13 Roberto Ierusalimschy <email@example.com>:
>> >> Why break can appear middle of block but not return?
>> > Because return may be followed by an optional expression. Something
>> > like 'return a = 3' would confuse the parser.
>> But then shouldn't "return; a = 3" be allowed ?
> if test then return end; a=3 -- OK
> if test then return else a=3 end -- OK
> if test then return; a=3 end -- what's this supposed to mean?
> function x() print "gotcha!" return; a=3 end -- never reaches a=3
> IMHO there is no situation in which "return; a = 3"
> can be milked into making sense.
It's just for consistency with:
if test then break; return a=3 end
which is allowed in 5.2, unless I misunderstood and then you can
ignore my question.