Re: [PHP-DEV] Suggested change: change priority of new and ->

2018-02-17 Thread Rowan Collins
On 8 February 2018 18:38:36 GMT+00:00, Mcmuffin Mcguffin 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 wo

Re: [PHP-DEV] Suggested change: change priority of new and ->

2018-02-17 Thread Mcmuffin Mcguffin
> > Is that creating an instance of the class name stored in the 0th index of > the array $var or is it creating an instance of the class name stored in > $var and accessing the 0th index using ArrayAccess? > As soon as $var gets involved, it should be prioritized above the new operator. So it's e

Re: [PHP-DEV] Suggested change: change priority of new and ->

2018-02-15 Thread Pedro Lacerda
Great contribution, very sensible even if subtile. Is the kind of change that improve a lot but cause some trouble to people used to the old way or when upgrading legacy codebases. 2018-02-15 5:32 GMT-03:00 Stephen Reay : > > > On 9 Feb 2018, at 01:38, Mcmuffin Mcguffin > wrote: > > > > new $va

Re: [PHP-DEV] Suggested change: change priority of new and ->

2018-02-15 Thread Stephen Reay
> On 9 Feb 2018, at 01:38, Mcmuffin Mcguffin wrote: > > new $var[0] Is that creating an instance of the class name stored in the 0th index of the array $var or is it creating an instance of the class name stored in $var and accessing the 0th index using ArrayAccess? Cheers Stephen -- PHP

Re: [PHP-DEV] Suggested change: change priority of new and ->

2018-02-14 Thread Fleshgrinder
On 2/8/2018 7:38 PM, Mcmuffin Mcguffin wrote: > What do you think? > > Jaroslav Wegner > Thanks for the hard work to figure out what the roots of this annoyance is. This could land in the next PHP version, considering that many other breaking changes were also allowed in the past, given the foll

Re: [PHP-DEV] Suggested change: change priority of new and ->

2018-02-08 Thread Haralan Dobrev
I really like the proposal and it's definitely improving more common modern use cases. However, I understand why the precedence is like that now in PHP to begin with and so I think this should target PHP 8. This change would be a bit similar to other weird use cases of variables which were change

[PHP-DEV] Suggested change: change priority of new and ->

2018-02-08 Thread Mcmuffin Mcguffin
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. You have to put an additional round of parentheses around new clause, such as: (ne