Re: Re: [RFC] Strict type hints (parameter and return value)
| From: | Sam Barrow | Date: | Thu, 17 Apr 2008 16:01:36 +0000 |
| Subject: | Re: Re: [RFC] Strict type hints (parameter and return value) | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-37079@lists.php.net to get a copy of this message | ||
On Thu, 2008-04-17 at 08:54 -0700, Chris Stockton wrote:
> I like this patch, it adds a feature which a lot of companies and code base
> would surely implement without breaking anything. The only thing I do not
> like has already been mentioned, numeric and scalar are not included.
>
> The one thing I don't dislike, but am unsure of the ease to understand by
> users is the return type hinting syntax, using type casting. Maybe I am
> wrong but do you think users might get confused by it since it already has
> an existing purpose of transforming values to other types, maybe they will
> think at glance it transforms the return type to something else? Of course
> it would be fault of there own for not reading, but is it NATURAL to use the
> existing type hints for it?
>
> Why not:
> function int foo($foo) { }
>
> I understand the problem with adding the INT as a keyword, and how that
> maybe:
> function int int($foo) { }
I like this alot better too, the only downside is compatibility
problems.
> is awkward, but would be rare and seems to be more correct. I know it would
> be more difficult to implement the latter but it should not be impossible
> should it?
>
> Just throwing it out there, it is a nice patch and a nice feature for A LOT
> of people even though it is not exactly the php way, but all things must
> evolve.
>
> -Chris