Re: [RFC] [Discussion] Typed class constants
| From: | Máté Kocsis | Date: | Fri, 03 Feb 2023 14:34:09 +0000 |
| Subject: | Re: [RFC] [Discussion] Typed class constants | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-119458@lists.php.net to get a copy of this message | ||
Hi Alexandru, Mark,
> 1. Why is object type not supported? I can't see a real reason and also
> there is no explanation why.
>
Sorry for this, mentioning object as unsupported was an artifact from the
original version of the RFC which
was created back then when constants couldn't be objects. After your
comments, I removed the object type
from the list. Thank you for catching this issue!
> 2. In the examples for illegal values, it would be good to explain why
> they are not legal.
> I don't understand why "public const ?Foo M = null;" wouldn't be legal.
> I think "?Foo" should work the same as "Foo|null" that would be legal.
>
> It was there due to the same reason as above. I removed this example now.
I had updated the RFC page, but it looks like the changes were reverted in
> December 2022. The updated version I was working on was:
> https://wiki.php.net/rfc/typed_class_constants?rev=1648644637
Yeah, the original author of the RFC was surprised to find your changes in
his RFC (https://github.com/php/php-src/pull/5815#issuecomment-1356049048),
so he restored his original version.
Next time, please either consult with the author of an RFC if you intend to
modify the wording, or you can simply create a brand new RFC - even if it's
very similar to the original one (just don't
forget to add proper references).
The updated RFC looks good, thanks for working on it. You may want to
> review the revised version I had worked on for implementation ideas, and
> review the previous conversations.
>
I also saw your proposal, but to be honest, I'm not that fond of the idea.
This doesn't mean though that you shouldn't create a new RFC or an
implementation, as others may find it useful. If you kick off
the project, I'll surely try to review your work.
Regards,
Máté Kocsis