Re: Re: type hinting
| From: | Sam Barrow | Date: | Mon, 07 Jan 2008 18:30:07 +0000 |
| Subject: | Re: Re: type hinting | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-34590@lists.php.net to get a copy of this message | ||
On Mon, 2008-01-07 at 13:16 -0500, Elizabeth M Smith wrote:
> Afternoon,
>
> Wow, go away for a weekend and look what happens...
>
> Personally I think the issue is that true "scalar" type hinting doesn't
> make much sense with a dynamically typed language. Deciding if/when/how
> to juggle a scalar typehint is going to make at least one person angry
> and some new user confused.
>
> However, I have to agree with the fact that the current typehinting
> system feels "unfinished". I can tell a function that it has to be
> passed an array or some specific type of object, but can't tell it that
> it has to be passed a scalar type, or a resource, or any generic object.
>
> These don't "juggle" well like the generic scalar (int, bool, float,
> string) types. Is there any reason we can't at least add "scalar" and
> "resource" (and possibly "object" for generic objects) to typehints? It
> wouldn't be the full "scalar typehinting" solution that people are
> yelling for, but it would cut out lines of bad input handling in my own
> code, and make the current typehint solution feel more complete.
Scalar, resource, and object type hints would be very useful, and fit
perfectly with the current type juggling system. I still support all of
the hints, but these 3 alone have an even stronger argument than the
other ones.
> My own $0.02,
> Elizabeth Smith
>