Hi Derick,

> Please, let's do the sensible and use the Rusty #[...] syntax.

I'd probably re-vote for `<<Attribute>>` given the fact that `@@` may introduce 
similar parsing ambiguities in the future
that may interfere with future language changes. (but those issues are not a 
certainty)

I think that `#[` has its own issues, but am open to re-voting on it.
For example, the following snippet would get parsed differently in PHP 7.4 and 
PHP 8.0, given a hypothetical JIT annotation for Opcache.
With <<Opcache\Jit>>, it would give people a clear indication that the file 
required PHP 8.0,
but a one-line annotation might be silently treated differently in many subtle 
ways in 7.4.
It's probably possible to amend the parser make it an error to put the function 
declaration on the same line or to have other `#` comments
within a multi-line #[ annotation,
but I really dislike the special casing it would add.

```
$function = array_filter(
    $values,
    #[Opcache\Jit] function(int $x) { return $x % 2 > 0; }
);
```

Cheers,
- Tyson
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to