[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Documentation for multiple assignment fails to mention order
- From: Nagaev Boris <bnagaev@...>
- Date: Tue, 26 Jul 2016 20:48:01 +0300
On Tue, Jul 26, 2016 at 8:17 PM, Niccolo Medici <niccolomedici@gmail.com> wrote:
> On 7/25/16, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
>>> > > <snip>
>>> > > BTW, is it guaranteed that the assignment order goes from RIGHT to
>>> > > LEFT (I verified this in Lua 5.1, 5.2, 5.3, LuaJIT), or is it
>>> > > "undefined behavior"?
>>> >
>>> > It is not undefined behavior at all.
>>> > <snip>
>>> > It is like in C, which does not specify the order of evaluation of
>>> > expressions in argument lists in function calls.
>>>
>>> You actually prove my point here. The C standard *does* say that the
>>> order is "unspecified". [...]
>>
>> Check your words. "unspecified behavior" (what the C standard says) is
>> different from "undefined behavior" (what you asked about). Lhf is
>> correct in saying that the behavior is not undefined, even though it is
>> unspecified.
>>
>> About the manual itself: there are infinite things that Lua does not do
>> but the manual fails to mention. So, if the manual does not define in
>> what order __newindex metamethods in multiple assignments are called,
>> it is safe to assume that the order is unspecified, even if the manual
>> does not say that.
>>
>> -- Roberto
>
> Thank you for your reply.
>
> I'll be going now to study the difference between "not undefined" to
> "undefined" to "unspecified". I accept your judgment fully, so the
> story is closed.
>
> I did notice LHF's use of the phrase "not undefined" instead of
> "unspecified", but I had to keep my post short so I removed that
> section in my reply (which is fortunate because otherwise Dirk would
> have had a stroke, not just a shock. I hope you didn't find me to be a
> troll, or "not humble" as someone else said. I apologize if it perhaps
> seemed this way. If it indeed seemed so, please let me know; I promise
> not to reply - I'll just take it in mind seriously and try to learn
> something from it).
>
http://c-faq.com/ansi/undef.html explains the difference between
implementation-defined, unspecified, and undefined behavior.
--
Best regards,
Boris Nagaev