Re: RFC proposal : "new" keyword shorthand

From: Date: Sat, 08 Jun 2024 01:44:42 +0000
Subject: Re: RFC proposal : "new" keyword shorthand
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message


On Jun 7 2024, at 8:49 pm, Erick de Azevedo Lima <[email protected]> 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 Dart are very readable without the extra new keyword (it supports instance
creation with new or without it). I haven't put any thought into the engine changes that would
be necessary to implement a similar syntax where new becomes optional, but I wouldn't be
opposed to such a change if there was a PR out there for it.
But I'm with you -- I think new is fine. I 100% don't want to see it replaced with some
sort of confusing shorthand, but I might be able to be convinced to make the keyword optional.
I also think in terms of value, cycles would be better spent on other things than to new or not to
new .
J


Thread (19 messages)

« previous php.internals (#123558) next »