octave-maintainers
[Top][All Lists]
Advanced

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

Re: undefined compound chaining behavior


From: Mike Miller
Subject: Re: undefined compound chaining behavior
Date: Mon, 9 Jun 2014 16:42:42 -0400

I think you've gotten a few very good and clear answers to your
questions, do you still have any unanswered questions about this
topic?

On Mon, Jun 9, 2014 at 21:47:32 +0330, Hossein Sajjadi wrote:
> "Except  where  noted,  evaluations  of  operands
> [...]
> For example in expression a + b the standard imposes no requirement if
> a evaluated first or b.
> so evaluation of expression a=1;a+=a+=4 due to above and other
> specifications in §1.9 of standard.

I think everyone is clear on your point about the C and C++ languages,
no need to quote the language specification.

> But "the Java programming language guarantees that the operands of
> operators appear
> to be evaluated in a specific evaluation order , namely, from left to
> right.§1.5"(The Java® Language Specification Java SE 8 Edition)
> so a=1;a+=a+=4; in Java programming language well defined.

Again, I think everyone also understands what you are saying about the
Java language.

> Octave has no standard, so evaluation of expressions can be in any order

Not sure what you meant here. Did you mean that Octave is not adhering
to any existing language standard, and therefore we could change the
order of evaluation if we wanted to? True, we could, but we don't want
to :)

Or do you mean that Octave's lack of a language standard means that
there is no document making it clear what the correct order of
evaluation is?

As Rik said and as the manual specifically advises [1], the best
policy is to avoid such nested assignments anyway.

[1] http://www.gnu.org/software/octave/doc/interpreter/Assignment-Ops.html

-- 
mike



reply via email to

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