Re: [RFC] Mixed Typehint
| From: | Levi Morrison | Date: | Tue, 19 Dec 2017 17:30:16 +0000 |
| Subject: | Re: [RFC] Mixed Typehint | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-101385@lists.php.net to get a copy of this message | ||
On Tue, Dec 19, 2017 at 10:05 AM, Andreas Hennings <andreas@dqxtech.net> wrote:
> We already have other "meta" types.
> E.g. "callable" can be a string, an array, an object with __invoke().
> A "numeric" can be float or int.
> A "iterable" can be an array or an traversable object.
For correctness:
callable is not the union string | array | object
because only certain kinds of strings, arrays, and objects are
accepted.
> Personally I don't think we need every possible union, let alone intersections.
How many do we need to have for us to make the conclusion we should
stop making special-cases in the engine and generalize it?
In any case we are straying off-topic: this thread is about mixed
which I would vote against. As our type-system stands it provides
almost no value. If our type system ever changes and it suddenly
provides value then it should be proposed at that point.