Re: [RFC] Amendments to Attributes

From: Date: Mon, 01 Jun 2020 10:03:38 +0000
Subject: Re: [RFC] Amendments to Attributes
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-110324@lists.php.net to get a copy of this message
On Mon, 1 Jun 2020 at 00:48, Theodore Brown <theodorejb@outlook.com> wrote: > > Having a distinct token for attributes would entirely avoid the issues > of having to modify multiple lines when adding/removing attributes, as > well as confusion with shift operators and comma-separated attribute > arguments. E.g. the RFC example would look like this instead: > > ```php > @@Attr2("foo") > @@Attr2("bar") > public function test() > { > } > ``` > I'm not sure what you mean by "having a distinct token"; the cases where there is any chance of confusion with bit-shifts are going to be very rare, and aren't related to any of the other issues you're discussing. You make some good points about not having comma-separated attributes, but they don't require us to change the syntax, just not add that feature to it. On a personal note, I find @@ a lot uglier than << and think a bracket-link syntax looks clearer when writing multiple attributes on one line to avoid long thin columns of code: <<Attr2("foo")>> <<Attr2("bar")>> public function test() { } vs @@Attr2("foo") @@Attr2("bar") public function test() { } Regards, -- Rowan Tommins [IMSoP]

« previous php.internals (#110324) next »