Hacker News new | ask | show | jobs
by jjice 1133 days ago
I don't see any comments there, I see attributes though [1]. Is that what you meant?

From the page you linked:

> Routes can be configured in YAML, XML, PHP or using attributes. All formats provide the same features and performance, so choose your favorite. Symfony recommends attributes because it's convenient to put the route and controller in the same place.

Attributes are not comments, they are an official structured way of handling metadata.

[1] https://www.php.net/manual/en/language.attributes.overview.p...

2 comments

Attributes are a newish thing in Php that got created because people were using comments as code. And yeah, before attributes Symfony would use comments to define routes right above the function definition.
I’m sorry, but if it’s using the same starting symbol as a comment, and it’s greyed out in the text editor like a comment, then you can call it whatever you want, but it is a fucking comment. There are a bunch of unused symbol combinations on the keyboard that could have been used, there is absolutely no excuse for it.
> it’s using the same starting symbol as a comment

In Java the keywords "public" and "private" use the same starting symbol too, what's your point? Attributes start with "#[", comments with "//" or "#". That's clear enough.

> it’s greyed out in the text editor like a comment

A language isn't responsible for a specific text editor's syntax highlighting.

> A language isn't responsible for a specific text editor's syntax highlighting.

It’s even greyed out like a comment in the official symfony documentation.