Re: Scalar type hinting

From: Date: Wed, 29 Feb 2012 16:21:08 +0000
Subject: Re: Scalar type hinting
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
I agree with Simon on this:

On Wed, Feb 29, 2012 at 08:58, Simon Schick <[email protected]> wrote:
> I'd like to split this discussion in parts:
>
>   - just type-hint in functions (as we have it with classes and arrays) or
>   bind a variable to a strict type?
>      - should it then also be possible bind variables to a specific class
>      or interface?
>   - should we go for weak or strong types?
>      - the type-hint is also weak in one way because it accepts all that's
>      compatible with the given type.

These make a lot more sense in terms of discussion and those who don't
agree on having strong type implemented in the language core would
probably see value in type-hinting like we have with classes & arrays
(even if here we enter again in a strong vs. weak discussion).

I for once agree it can be useful to have type-hinting for the other
types, including throwing an error if there's loss of data in
conversion. Although I'm not so sure about having strong types...

Regards,
Daniel Macedo


Thread (163 messages)

« previous php.internals (#58337) next »