Re: [PHP-DEV] The @@ is terrible, are we sure we're OK with it?

This is only part of a thread. view whole thread
July 23, 2020 07:37 (Matteo Beccati)

On 22/07/2020 19:09, tyson andre wrote:
> 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 <>, 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.
This is pretty much the reason why I didn't go for '#[' as my first choice: the false sense of backwards compatibility that can be easily (and inadvertently) defeated with multiline attributes or inline function definition. Since '@@' is causing such unrest, I'd be happy to revisit my choice and embrace '#[', which was the second option in my vote. Cheers -- Matteo Beccati Development & Consulting -