develooper Front page | perl.perl5.porters | Postings from August 2018

Re: [perl #133301] Evalulation order during concat changed

Thread Previous | Thread Next
Eirik Berg Hanssen
August 11, 2018 13:36
Re: [perl #133301] Evalulation order during concat changed
Message ID:
On Sat, Aug 11, 2018 at 12:58 PM Wolf-Dietrich Moeller (München) <> wrote:

> Resent because of problems. Sorry
> -----Original Message-----
> From: Wolf-Dietrich Moeller (München) [mailto:
> Sent: Samstag, 11. August 2018 10:34
> To: ''
> Cc: 'Dave Mitchell'; 'Eirik Berg Hanssen'; 'David Nicol'; '
>'; 'Dan Book'
> Subject: RE: [perl #133301] Evalulation order during concat changed
> David cited the old perlop doc (up to Perl 5.26). This documentation
> was changed in Perl 5.28 and the section on operator precedence and
> associativity was extended quite a lot (see [perl #127391]).
> One sentence there reads:
> "In fact Perl has a general rule that the operands of an operator
> are evaluated in left-to-right order."
> Eirik, did you consider this new text?

  No, sorry; I was unaware of it.

  That might be a game changer.

  Or not; the new text is still pretty vague, and don't strictly match the
behaviour of perl.  I also don't see any discussion of this part of the
patch in the RT ticket ...

  Reading that ticket, I get the impression of a failure to properly
distinguish between (operand) evaluation order and the order in which
_operations_ are evaluated.  I'm sorry I didn't catch that at the time: I
surely would have quibbled.

  This example demonstrates that the left-hand operand is evaluated _after_
the right-hand operand, in violation of this "general rule":

eirik@greencat[15:26:12]~$ perl -E 'say for ($x=1 + say "LHS") = ($x=2 +
say "RHS")'

  ... assuming that did not also change?  (I don't have a new perl here;
currently stuck on vanilla Ubuntu 18.04.1 LTS and it system perl v5.26.1.)


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About