RE: [PHP-DEV] Scalar Type Hints v0.4
| From: | François Laupretre | Date: | Wed, 18 Feb 2015 15:47:08 +0000 |
| Subject: | RE: [PHP-DEV] Scalar Type Hints v0.4 | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-83087@lists.php.net to get a copy of this message | ||
> De : Leigh [mailto:leight@gmail.com]
>
> Can we keep a 0) of "reserve names for future use in-case of RFC
> failure" option.
Reserving names is only needed as long as we keep keywords sharing the same naming space as classes.
This is a mistake from the past and, as long as we keep it, each new keyword is a pain. Reserving
keywords in advance can only lead to reserving too few or too much. So, IMO, deprecating bare class
names as hint is first. Then, we can reserve a limited set of keywords.
> How do you propose weak typing works with these? Does it only allow
> one of the union of types through (thus making it strict), or does it
> try and coerce to one if it can? Which one does it pick?
That's exactly the problem we need to solve before going the union type road. A limited set can
be implemented now as new zpp types, but none that requires questionable conversion (while useful,
we are not ready for 'int|float', for example).
Regards
François