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

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

Thread Previous | Thread Next
Sawyer X
August 24, 2018 13:59
Re: [perl #133301] Evalulation order during concat changed
Message ID:

On 08/24/2018 11:38 AM, Dave Mitchell wrote:
> On Thu, Aug 23, 2018 at 02:39:08PM -0500, David Nicol wrote:
>>  Binary C<"."> concatenates two strings.
>> +
>> +A series of terms joined by  C<"."> operators are evaluated prior to
>> +all getting concatenated in a single operation.  Prior to version 5.28,
>> +aliasing issues only affected the value of the first term in a series
>> +of concatenations, as the left side of the second and later operations
>> +was the intermediate result of the previous binary operation.
> What this documentation patch does, is change what was undefined
> behaviour (or at least that was my feeling of where the discussion ended
> up) into defined behaviour, which we are now committed to support.
> I don't want the internal (and possibly changeable) details of an
> optimisation to become a straight jacket.
> [...]
> In conclusion, I don't think the pod for the concatenation op should
> specify anything about order. I think that we should however fix the text
> recently added to perlop which implied a guarantee about the ordering of
> arg evaluation in general which we shouldn't have given.

The documentation could specify the lack of guarantee. That would remove
any possible ambiguity about whether it's defined or not.

"The order in which concatenated expressions is undefined and should not
be relied upon."

(Or some better phrasing.)

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