octave-maintainers
[Top][All Lists]
Advanced

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

Re: undefined compound chaining behavior


From: Hossein Sajjadi
Subject: Re: undefined compound chaining behavior
Date: Tue, 10 Jun 2014 16:42:25 +0330

> Ok, I understand. I think the best thing you can do to resolve this is
> to report a bug [1] requesting that the manual be updated to describe
> this behavior of assignment operators more clearly. To be clear, there
> is no undefined behavior here, it's just that OP= means that the
> left-hand side of the assignment is evaluated when the assignment is
> made. So the simple equivalence described in the manual is not correct
> if EXPR2 modifies EXPR1 as a side effect.
>
> [1] https://savannah.gnu.org/bugs/?func=additem&group=octave
>
> Thanks,
>
> --
> mike
>

By introduction of compound assignment in Octave it is intended to be
an improvement regards to Matlab but this introduce other issuses such
as violation of referential transparency.
I suggest two approach:
1. Do not allow compound assignment to be chained (  VB.NET , PACAL ,
Python, Go)
2. compound assignment can be chained but like what Java, C# , julia ,.. do.
I prefer second approach but it seems that you say correctly what you say:

"We can change the order of evaluation if we want to, but we don't want to."

I think the rules, if there are any rules, should be updated.
Thank you very much,

Hossein



reply via email to

[Prev in Thread] Current Thread [Next in Thread]