Re: Generics proposal
| From: | Christian Schneider | Date: | Sun, 21 Oct 2012 12:39:37 +0000 |
| Subject: | Re: Generics proposal | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-63581@lists.php.net to get a copy of this message | ||
Am 21.10.2012 um 13:33 schrieb Nikita Nefedov <inefedor@gmail.com>:
> No, this is useful in any OOP-language where there is such thing as type, and people need to
> validate types.
I question the "need to validate" types part. I'd say you're better off using a
completely different language if you want to use strong typing. For PHP: Embrace duck typing, write
less boiler-plate code (thus reducing the need for "smart" IDE) and be happy :-)
> I unerstand what you are saying about PHP being an easy language, but in opinion if you
> don't want to use that feature you can not use it, as you can not use typehinting in functions
> for example.
That's the same as saying you can ignore most of the C++ feature and that will make it a simple
language. That's neither true for developers nor users of the language.
Example on why this is are
1) Makes language harder to maintain as there is more (and more complex) code implementing it.
2) Makes documentation bigger so users have first to figure out what part to read and what part to
ignore.
3) Makes it harder to write portable user-land libraries as the application and the different
libraries might use different (clashing) paradigms. See error codes vs. exceptions as an example of
this.
4) Makes it harder to have extensions like APC as they have to implement more features.
5) Makes it harder to write alternative implementations.
...
So yes, I agree with Rasmus that this is not a good fit for PHP.
- Chris