Re: [VOTE] Shorter Attribute Syntax Change

From: Date: Tue, 18 Aug 2020 14:37:52 +0000
Subject: Re: [VOTE] Shorter Attribute Syntax Change
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  Groups: php.internals 
Request: Send a blank email to internals+get-111612@lists.php.net to get a copy of this message
On Tue, Aug 18, 2020 at 8:49 AM Aleksander Machniak <alec@alec.pl> wrote: > On 18.08.2020 00:35, Mike Schinkel wrote: > > 1. Postpone inclusion of attributes until PHP 8.1 > > +1 > > I wonder why my suggestion (somewhere in this thread) didn't get any > attention. Is it because the ship had sailed or it's a terrible idea? > A suggestion requires a patch, otherwise it's just theoretical. One problem I see with your suggestion is the conflict in a code like this: <?php declare(strict_types=1); declare(SomeAttr) function foo() {} It would probably require another keyword, someone else suggested "attribute" (conflicts with class Attribute) or "use attribute" (along the lines of "yleld from") or something. In any case, without a patch showing viability we cannot consider it. > > declare( > SomeAttr, > AnotherAttr("Hello world") > ) > function someFunc() { > } > > It's almost identical to #[] or @[], but it looks like PHP and has no BC > breaks. To me it also sounds good - "declare attribute(s) [for] something". > > ps. sorry Mike for a duplicate, I pressed the wrong button. > > -- > Aleksander Machniak > Kolab Groupware Developer [https://kolab.org] > Roundcube Webmail Developer [https://roundcube.net] > ---------------------------------------------------- > PGP: 19359DC1 # Blog: https://kolabian.wordpress.com > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > >

« previous php.internals (#111612) next »