Re: [RFC] Mixed Typehint
| From: | Christian Schneider | Date: | Tue, 19 Dec 2017 09:20:13 +0000 |
| Subject: | Re: [RFC] Mixed Typehint | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-101378@lists.php.net to get a copy of this message | ||
Am 19.12.2017 um 09:49 schrieb Stanislav Malyshev <smalyshev@gmail.com>:
>> The current one isn't any convention, it's just not possible to do
>> something else. There's nothing that explicitly allows saying "I accept
>> all types", rather than "The type I accept is unspecifed".
>
> There could be of course logical constructions that are not supported by
> the type system. "mixed" however has the accepted meaning - and that
> meaning is exactly the same as not specifying the type. I do not see any
> additional use of type that only means "unspecified type" - it looks
> like its sole reason is so that somebody could say "I now have lots of
> types in my code!" which does not seem to me a worthy goal. Types should
> serve a purpose, this one serves none.
I agree, if you want to document that you code accepts mixed types you could simple write /* mixed
*/, i.e. a comment.
If you're talking about tool support then the tool could also support this comment. Would not
be unheard of either.
- Chris