回复: [PHP-DEV] Replace ugly attribute toke n #[] to other
| From: | chopins xiao | Date: | Wed, 23 Aug 2023 09:10:44 +0000 |
| Subject: | 回复: [PHP-DEV] Replace ugly attribute toke n #[] to other | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-120927@lists.php.net to get a copy of this message | ||
but still ugly writing, now recommends using exceptions instead of errors, so should be deprecated
error control
now PHP already uses a lot of combine marks (more than 30), All marks on the keyboard are already in
use
just as Dung-Mountain-Code
Regards
Chopin Xiao
________________________________
发件人: Alexandru Pătrănescu <drealecs@gmail.com>
发送时间: 2023年8月23日 16:16
收件人: chopins xiao <chopins.xiao@gmail.com>
抄送: internals@lists.php.net <internals@lists.php.net>
主题: Re: [PHP-DEV] Replace ugly attribute token #[] to other
On Wed, Aug 23, 2023 at 9:36 AM chopins xiao <chopins.xiao@gmail.com<mailto:chopins.xiao@gmail.com>> wrote:
I use @ instead of #[] as attribute token. attribute use whitespace marks are closed. Of course you
can start with @@ or #, other.
error control use @@ instead of @, add T_SILENCE token
<snip>
my implemented:
https://github.com/chopins/php-src/tree/new-syntax/attribute
Other new syntax implemented (Verification of feasibility) :
https://github.com/chopins/php-src/blob/php-alternative-syntax/alternative-syntax.md
Regards
Chopin Xiao
Hey Chopin
You can check:
https://wiki.php.net/rfc/attributes_v2, that
initially implemented it with <<Attribute>>
https://wiki.php.net/rfc/shorter_attribute_syntax,
that changed the syntax to @@Attribute
https://wiki.php.net/rfc/shorter_attribute_syntax_change,
that finally changed the syntax to #[Attribute]
In time, the last syntax proved to be good, especially when dealing with code that must run as well
on PHP versions before PHP 8.0, as it's interpreted there as a comment.
All I can see right now are a lot of backward incompatible changes that are unlikely to be accepted
with no clear gains.
Please consider them, so that there is a clear upgrade path for existing codebase.
Regards,
Alex