Re: [RFC] Shorter Attribute Syntax Change RFC 0.2
| From: | Derick Rethans | Date: | Tue, 04 Aug 2020 15:28:23 +0000 |
| Subject: | Re: [RFC] Shorter Attribute Syntax Change RFC 0.2 | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-111323@lists.php.net to get a copy of this message | ||
On Tue, 4 Aug 2020, Sara Golemon wrote:
> On Tue, Aug 4, 2020 at 9:03 AM Benjamin Eberlei <kontakt@beberlei.de> wrote:
>
> > It provides a small BC break where code written as @[$foo, $bar] =
> > baz(); or $foo = @["bar" => $baz]; will not compile on PHP 8
> > anymore, but that can be easily fixed by writing it with a space
> > between @ and [.
> >
> If those are the potential breaks we're choosing between, I would
> favor #[...] as it provides strong forward-compatibility to drive
> adoption and use at the cost of a parse error that's easily fixed
> (even programmatically with a very simple script). @[...] provides no
> forward compat with a roughly equal chance of easily fixed syntax
> break.
>
> Given that, the choice seems obvious to me. Change my mind?
I pretty much agree, but @[ … ] is there as a compromise as it does show
some fmailiarity with the already existing @ in doc blocks.
cheers,
Derick
--
PHP 7.4 Release Manager
Host of PHP Internals News: https://phpinternals.news
Like Xdebug? Consider supporting me: https://xdebug.org/support
https://derickrethans.nl | https://xdebug.org | https://dram.io
twitter: @derickr and @xdebug