On Tue, 10 Mar 2020 at 10:54, Rowan Tommins <rowan.coll...@gmail.com> wrote:
> > C#: [Foo] > Rust: #![Foo] or #[Foo] > C++: [[Foo]] > Java: @Foo > ECMAScript (proposed): @Foo > Go: `Foo` or "Foo" > Doctrine et al: /** @Foo */ > Hack: <<Foo>> > > To add to that list, Python decorators, which serve a similar purpose, also use @Foo, and in confirming that I came upon some interesting discussions of how they came to that syntax in https://www.python.org/dev/peps/pep-0318/ and a long list of alternative proposals at https://wiki.python.org/moin/PythonDecorators There was apparently an alternative proposal for a "using" keyword, but it was ultimately rejected in favour of the punctuation form. Not all of the considerations apply to the PHP case, but this quote from Guido is rather interesting: > The keyword starting the line that heads a block draws a lot of attention to it. > This is true for "if", "while", "for", "try", "def" and "class". But the "using" keyword (or any other keyword in its place) > doesn't deserve that attention; the emphasis should be on the decorator or decorators inside the suite, > since those are the important modifiers to the function definition that follows. > When a function definition carries one or more decorators, the most important information > is not the fact that it has decorators, but the specific decorators used. I think that applies to our case equally: any punctuation or keyword is just a separator between the main function declaration and the specific attribute being applied. Having to write "attribute Sealed" would be like having to write "visibility public"; as much as possible, we want "Sealed" to be the keyword, and the rest of the syntax to just be formatting. Regards, -- Rowan Tommins [IMSoP]