Re: Operator precedence is undefined?

From: Date: Sat, 20 Jul 2013 10:33:01 +0000
Subject: Re: Operator precedence is undefined?
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On 07/20/2013 08:00 AM, Sherif Ramadan wrote:
> While this is very true it's also a matter of discretion, because the
> language doesn't clearly define a lot of things. In fact, one can argue
> that there is no language definition at all since PHP doesn't even have a
> spec. Though I'm trying to take common sense into consideration and make an
> exception that in this case I don't see where removing the comment of
> undefined behavior is going to necessarily cause more harm than good. Since
> in the case of undefined behavior people will be left to wonder (why
> doesn't ever seem to print 5?) We should either elaborate on why it *might*
> print 5 in a full note on that page or we should remove the comment
> completely. I oppose a documentation that leaves much room for clarity.
> 
> But perhaps for me it was easier to suggest removing the comment than
> trying to clarify on why the behavior is undefined.

The language spec is a combination of the grammar and the documentation.
The documentation has stated this is undefined for a long time now. The
reasoning behind it was that since C and C++ both quite explicitly state
this is undefined and since implementations of PHP are likely to be in C
and C++ chances were pretty good that this undefined behaviour would end
up being inherited. Now, as it turns out, we haven't had that many
implementations of the language. But, there have been some. Also,
optimizers could potentially do something intelligent here that could
potentially change the outcome.

-Rasmus


Thread (30 messages)

« previous php.internals (#68268) next »