Hacker News new | past | comments | ask | show | jobs | submit login

> And the worst being the attribute #[] syntax... why?! Almost every other language uses @attribute, and it is successful: simple to write, easy to read, why on earth a new and such complicated solution?

Simple, it was already taken up [1]. Also `@attribute` syntax is by no way universal (and semantics wildly vary even with the same syntax): `#[]` in particular might have been inspired by Rust.

[1] https://www.php.net/language.operators.errorcontrol




The rfcs have a lot of discussion on those subjects indeed, but I still disagree with the choice!

Also, the current use of @ is before a function call or some get, not before a method/class/... declaration, so a change in that direction would probably be possible. (plus the @ to suppress errors should probably be removed from the language anyway!)


It's not possible because PHP has a LALR(1) parser but this would require arbitrary lookahead.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: