Re: [PHP-DEV] RFC proposal : "new" keyword shorthand

2024-06-07 Thread John Coggeshall
On Jun 7 2024, at 8:49 pm, Erick de Azevedo Lima wrote: > The new keyword is meaningful and everyone knows what's being done just by > looking at it. Removing it would make the language less readable. But it's a > BC so big that I don't think it can be done anyway. > > FWIW Languages like Da

Re: [PHP-DEV] RFC proposal : "new" keyword shorthand

2024-06-07 Thread Erick de Azevedo Lima
> Please, don't make PHP as unreadable as Perl. IMO It's two extra characters at worst and would be solved much more elegantly by removing the new keyword entirely. The new keyword is meaningful and everyone knows what's being done just by looking at it. Removing it would make the language less r

Re: [PHP-DEV] RFC proposal : "new" keyword shorthand

2024-06-07 Thread John Coggeshall
> So here is my proposal : > > Add a "new" shorthand, using the tilde character : "~" -10. Please, don't make PHP as unreadable as Perl. IMO It's two extra characters at worst and would be solved much more elegantly by removing the new keyword entirely. J

Re: [PHP-DEV] RFC proposal : "new" keyword shorthand

2024-06-07 Thread Bilge
On 07/06/2024 22:34, Erick de Azevedo Lima wrote: I also think that `new `(4 chars, if we count the blank space) is short enough. Strongly agree. This solves a problem nobody has. Feel free to carry on regardless, though; curious to see where this ends up going. Bilge

Re: [PHP-DEV] RFC proposal : "new" keyword shorthand

2024-06-07 Thread Lynn
On Fri, Jun 7, 2024 at 11:50 PM Larry Garfield wrote: > On Fri, Jun 7, 2024, at 9:34 PM, Erick de Azevedo Lima wrote: > > Hi all. > > > >> Em sex., 7 de jun. de 2024 às 17:53, Pierre > escreveu: > >> I do agree with you that when you use value objects, you need it a lot, > >> but I'd much prefer

Re: [PHP-DEV] RFC proposal : "new" keyword shorthand

2024-06-07 Thread Larry Garfield
On Fri, Jun 7, 2024, at 9:34 PM, Erick de Azevedo Lima wrote: > Hi all. > >> Em sex., 7 de jun. de 2024 às 17:53, Pierre >> escreveu: >> I do agree with you that when you use value objects, you need it a lot, >> but I'd much prefer having a JS like value objects initializer syntax, >> such as `

Re: [PHP-DEV] RFC proposal : "new" keyword shorthand

2024-06-07 Thread Erick de Azevedo Lima
Hi all. > Em sex., 7 de jun. de 2024 às 17:53, Pierre escreveu: > I do agree with you that when you use value objects, you need it a lot, > but I'd much prefer having a JS like value objects initializer syntax, > such as `Point {x: 1, y: 2}` syntax than creating another way to call > the construc

Re: [PHP-DEV] RFC proposal : "new" keyword shorthand

2024-06-07 Thread Benoît Condaminet
Le ven. 7 juin 2024, 21:31, Larry Garfield a écrit : > On Fri, Jun 7, 2024, at 5:56 PM, ericm...@php.net wrote: > > >> Instead of ~ (which reminds me of the pendulum of symbols to written to > symbols and back again every 10ish years; “or” vs “||”), why not make a > shorthand way to write a funct

Re: [PHP-DEV] RFC proposal : "new" keyword shorthand

2024-06-07 Thread Pierre
Le 07/06/2024 à 21:38, Larry Garfield a écrit : On Fri, Jun 7, 2024, at 7:20 PM, Pierre wrote: I sincerely do not want to see a new operator for replacing the "new" operator, because then we would have two different syntaxes which would be semantically equivalent. Creating a new object, in mos

Re: [PHP-DEV] RFC proposal : "new" keyword shorthand

2024-06-07 Thread Larry Garfield
On Fri, Jun 7, 2024, at 7:20 PM, Pierre wrote: > I sincerely do not want to see a new operator for replacing the "new" > operator, because then we would have two different syntaxes which would > be semantically equivalent. > > Creating a new object, in most API design, is not something you do ve

Re: [PHP-DEV] RFC proposal : "new" keyword shorthand

2024-06-07 Thread Andreas Hennings
On Fri, 7 Jun 2024 at 21:17, Rob Landers wrote: > > > > On Fri, Jun 7, 2024, at 21:02, Andreas Hennings wrote: > > On Fri, 7 Jun 2024 at 20:31, Larry Garfield wrote: > > > > On Fri, Jun 7, 2024, at 5:56 PM, ericm...@php.net wrote: > > > > >> Instead of ~ (which reminds me of the pendulum of symbo

Re: [PHP-DEV] RFC proposal : "new" keyword shorthand

2024-06-07 Thread Pierre
Le 07/06/2024 à 18:03, Benoît Condaminet a écrit : Hello, Following the RFC process, I'm sending this to propose a PHP change. More precisely a new zend language token. This is somehow linked to the recently accepted RFC called "new MyClass()->method() without parentheses", the goal is to in

Re: [PHP-DEV] RFC proposal : "new" keyword shorthand

2024-06-07 Thread Rob Landers
On Fri, Jun 7, 2024, at 21:02, Andreas Hennings wrote: > On Fri, 7 Jun 2024 at 20:31, Larry Garfield wrote: > > > > On Fri, Jun 7, 2024, at 5:56 PM, ericm...@php.net wrote: > > > > >> Instead of ~ (which reminds me of the pendulum of symbols to written to > > >> symbols and back again every 10i

Re: [PHP-DEV] RFC proposal : "new" keyword shorthand

2024-06-07 Thread Andreas Hennings
On Fri, 7 Jun 2024 at 20:31, Larry Garfield wrote: > > On Fri, Jun 7, 2024, at 5:56 PM, ericm...@php.net wrote: > > >> Instead of ~ (which reminds me of the pendulum of symbols to written to > >> symbols and back again every 10ish years; “or” vs “||”), why not make a > >> shorthand way to write

Re: [PHP-DEV] RFC proposal : "new" keyword shorthand

2024-06-07 Thread Larry Garfield
On Fri, Jun 7, 2024, at 5:56 PM, ericm...@php.net wrote: >> Instead of ~ (which reminds me of the pendulum of symbols to written to >> symbols and back again every 10ish years; “or” vs “||”), why not make a >> shorthand way to write a function that calls a constructor (kinda sorta like >> C# ex

Re: [PHP-DEV] RFC proposal : "new" keyword shorthand

2024-06-07 Thread ericmann
On 6/7/24 10:35, Rob Landers wrote: On Fri, Jun 7, 2024, at 18:03, Benoît Condaminet wrote: Hello, Following the RFC process, I'm sending this to propose a PHP change. More precisely a new zend language token. This is somehow linked to the recently accepted RFC called "new MyClass()->metho

Re: [PHP-DEV] RFC proposal : "new" keyword shorthand

2024-06-07 Thread Rob Landers
On Fri, Jun 7, 2024, at 18:03, Benoît Condaminet wrote: > Hello, > > Following the RFC process, I'm sending this to propose a PHP change. More > precisely a new zend language token. > > This is somehow linked to the recently accepted RFC called "new > MyClass()->method() without parentheses"

Re: [PHP-DEV] RFC proposal : "new" keyword shorthand

2024-06-07 Thread John Bafford
Hi Benoît, > On Jun 7, 2024, at 12:03, Benoît Condaminet > wrote: > > As a first try, I start updated code to completely make the new keyword > optional, like in Dart language for example, but it require very big change, > with lot of impact (collision with function). > > So here is my prop

[PHP-DEV] RFC proposal : "new" keyword shorthand

2024-06-07 Thread Benoît Condaminet
Hello, Following the RFC process, I'm sending this to propose a PHP change. More precisely a new zend language token. This is somehow linked to the recently accepted RFC called "new MyClass()->method() without parentheses", the goal is to introduce a shorthand for the "new" keyword. *Motivations