Re: [RFC] Shorter Attribute Syntax Change RFC 0.2

From: Date: Wed, 19 Aug 2020 09:12:47 +0000
Subject: Re: [RFC] Shorter Attribute Syntax Change RFC 0.2
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-111626@lists.php.net to get a copy of this message
On Wed, Aug 19, 2020 at 11:01 AM Andreas Leathley <a.leathley@gmx.net> wrote: > On 19.08.20 10:47, Benjamin Eberlei wrote: > > One last change that I didn't see yesterday as it was on Github and not > > this list is the addition of another syntax proposal @{} with the same > > benefits as @[], a little more snowflake than compared to other > languages, > > but without the BC Break. > > I mentioned the benefits of @{} in an email to this list on Monday, with > the proposal to have both @@ and @{} as attribute syntax, so both camps > could have their syntax (one with delimiters, one without) with minimal > BC breaks, and leave the decision to the PHP developers/projects what > they prefer in what circumstances, because there can be valid reasons to > use both - I probably would use both. @{} could be good to define > multiple attributes for classes/properties, @@ could be good for short > attributes or ones very entrenched within the code, like function > parameters. The @{} syntax could be amended in the future, so this would > also be "future-proof". > > But I guess the division about syntax is too big at this point to > consider an approach where we just offer both types of syntax. From a > PHP developer viewpoint, it would be preferable though. > The "problem" with having both @@ and @{} would be that we would need two new tokens instead of one. We have a bunch of proposals that would support both grouped and ungrouped with the same syntax, so a solution that ends up ending two new tokens and syntaxes would be less preferable. With the choice being @@ or @{} - nothing would stop someone (not me ;-)) to make an RFC for 8.1 or later proposing to add a second syntax.

« previous php.internals (#111626) next »