Typehints (was Re: [PHP-DEV] Annoucing PHP 5.4 Alpha 1)
| From: | Derick Rethans | Date: | Tue, 10 Aug 2010 22:32:26 +0000 |
| Subject: | Typehints (was Re: [PHP-DEV] Annoucing PHP 5.4 Alpha 1) | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-49287@lists.php.net to get a copy of this message | ||
On Wed, 11 Aug 2010, Johannes Schlüter wrote:
> On Wed, 2010-08-11 at 00:03 +0200, Kalle Sommer Nielsen wrote:
> > type hinting
>
> For the record: I consider the current implementation as (one of) the
> biggest mistakes in the last ten years.
I will try to sum up my view point once more:
1. right now we *have* strict type checks for classes and arrays in the
form of "classname" or "array"
2. the strict scalary type hint patch reuses this same syntax in the
form of <type-name> to do the same thing in function arguments
3. we have casting type hints in the rest of the code in the form of
"(int)".
Some people don't like strict typehints, but the syntax as it currently
is regarding type hints is *consistent*. Now, to allow both strict and
casting hints, the logical step seems to be, to give the weak typehint
advocates their tool as well:
4. We add casting typehings to function arguments in the form of "(int)"
so that that is consistent as well. We would need to figure out
whether we want:
a. warnings on conversions (my choice)
b. no warnings
This:
- keeps the syntax consistent
- allows both strict and weak typehints
Should make everybody happy (enough), right?
regards,
Derick
--
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug