On Thu, Jul 2, 2020 at 2:13 AM Theodore Brown <theodor...@outlook.com>
wrote:

> On Wed, June 17, 2020 at 5:59 PM Theodore Brown wrote:
>
> > I've opened voting on the Shorter Attribute Syntax RFC:
> > https://wiki.php.net/rfc/shorter_attribute_syntax
> >
> > Since all RFCs require a primary vote with a 2/3 majority, there is
> > a main vote to approve the secondary ranked-choice vote.
> >
> > For the ranked-choice poll, fill in your first through third syntax
> > choices, making sure not to select the same syntax more than
> > once. You don't have to vote for all three options, but please
> > don't leave gaps.
> >
> > Voting will end in two weeks, on 2020-07-01.
>
> Hi internals,
>
> The Shorter Attribute Syntax RFC vote is now closed. The primary poll
> for re-voting on attribute syntax was approved with 50 in favor and 8
> opposed.
>
> For the secondary ranked-choice poll there are 61 valid ballots. Since
> only one syntax can be elected, the quota is floor(61 / 2) + 1 = 31.
>
> Note: one ballot wasn't counted since it selected the same syntax
> more than once. However, this does not change the vote outcome.
>
> In the first round the tally is as follows:
>
> @@: 34 votes
> #[]: 21 votes
> <<>>: 6 votes
>
> So @@ reaches the quota and has been elected as the final attribute
> syntax for PHP 8.
>
> Thank you to everyone who voted!
>

Hi Theodore,

Unfortunately, the RFC failed to mention a small, but important detail: The
@@ syntax is ambiguous, as pointed out by Martin Schröder:

function (@@X \ Y $param) { }

Taking into account that PHP allows whitespace between namespace
separators, this can either be interpreted as an attribute "X\Y" on an
untyped parameter, or as an attribute "X" on a "\Y" typed parameter.

The RFC implementation solves this by treating @@ and the following name as
a single token that does not permit whitespace. As such, it will be
interpreted as "X" with an "\Y" typed parameter.

Now, if this had been explicitly mentioned in the RFC, we could have made
an explicit decision to accept this language inconsistency: To forbid
whitespace in namespaced names for attributes only, unlike all other places
in PHP accepting namespaced names. However, it was not mentioned in the
RFC, and apart from the authors of the proposal, I don't think anyone was
aware of this ambiguity.

Fortunately, there is still a way to resolve this issue in a consistent
manner: Change the handling of namespaced names in PHP in general. This is
exactly what is proposed in
https://wiki.php.net/rfc/namespaced_names_as_token. If that proposal is
accepted, then the ambiguity would disappear (and the above example would
become a parse error).

My plan would be to change the
https://wiki.php.net/rfc/namespaced_names_as_token proposal to either only
deal with the handling of namespaced names (i.e. as a single,
whitespace-free token), or at least separate the other reserved keyword
related changes into a separate vote.

If that proposal passes, then there should be no issue with adopting the @@
syntax for attributes (unless there are other problems I'm not aware of?)
If it does not pass, then we'll have to discuss what we want to do here.

Regards,
Nikita

Reply via email to