Re: The @@ is terrible, are we sure we're OK with it?

This is only part of a thread. view whole thread
July 23, 2020 16:36 (Mark Randall)
On 22/07/2020 13:00, Derick Rethans wrote:
> - There are lots of grumbles, both on here, room 11, as well as in the > wider community (
From discussions in R11 I want to offer the following example of why either option with a closing tag is preferable to allow maximum flexibility in future development. Assume we want to extend attributes to include something a lot of PHP features have, an access scope, to only allow accessing annotations from within the class itself, or a descendant. Then we end up with something like : class Foo { @@protected Attr protected int $bar; } Contrast that to something with opening and closing tags where they are clearly grouped: class Foo { #[protected Attr] protected int $bar; } What other syntax might we want to add? Perhaps we want to add a way to enforce validation at encounter time with a "checked" keyword. @@checked protected Attr(1,2,3) protected int $bar #[checked protected Attr(1,2,3)] protected int $bar It's much less ambiguous what belongs to what. Now we could dig ourselves out of this hole using additional tokens around @@ such as @@(checked protected Attr) but at which point why not just use a mechanism that supports it out of the box? Mark Randall