Re: [RFC] Shorter attribute syntax

From: Date: Thu, 04 Jun 2020 10:47:17 +0000
Subject: Re: [RFC] Shorter attribute syntax
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-110364@lists.php.net to get a copy of this message
Hey! That's why I am against this RFC or any other "change style to what I prefer". PHP's current attribute syntax is consistent with other languages and poses no BC breaks whatsoever. Best regards, Benas On Thu, Jun 4, 2020, 1:37 PM Ilija Tovilo <tovilo.ilija@gmail.com> wrote: > > > Does the PHP parser prevent us from adopting #[attr]? I presume C#'s > [attr] > > > syntax and C++'s [[attr]] are impossible due to PHP's short array > syntax. > > > > yes, that would create ambiguity in the parser since # > > (just like //) > > is for comments. > > I've mentioned this off-list before. If we consider @@ with a BC break > we could also consider #[] by making #[ a symbol. > This is also a breaking change but a probably similarly small one. It > would break code like this: > > # Comments still work > #[ <-- But they can't start with #[ > > To me both of those look acceptable but #[ looks nicer (but that's > just my personal preference). > > Ilija > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.internals (#110364) next »