On 8 February 2018 18:38:36 GMT+00:00, Mcmuffin Mcguffin 
<mcmuffinmcguf...@gmail.com> wrote:
>Hi,
>
>It's a common idiom in object-oriented languages to create an object
>and
>then immediately call a method on it, such as (in C# or Java):
>
>new DateTime ().ToString ()
>
>However, PHP grammar does not work this way.

This would definitely be nice to have, and thanks for looking into what the 
necessary change would look like.

I think the next challenge is to work out the different ways a dynamic class 
construction could happen, and which ones:
a) will be unaffected by the change
b) are an error now and will be allowed after
c) are allowed now and will be an error after
d) will work in both versions but change behaviour

It's anything that falls into category (d) that is particularly problematic, as 
it means users will see odd bugs of they don't know about the change. The 
clearer we can make these examples, the better.

Contrary to other responses, I think this would definitely need to happen in a 
major version, as it is quite clearly a breaking change. There's not much that 
can be done to deprecate code relying on the current rules, but we can 
publicise how to make code that is compatible before and after.

Regards,

-- 
Rowan Collins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to