Re: Scalar-type-hinting - which way is the best to go?

From: Date: Sun, 18 Mar 2012 11:12:09 +0000
Subject: Re: Scalar-type-hinting - which way is the best to go?
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
2012/3/18 Simon Schick <[email protected]>:
> 2012/3/18 John Crenshaw <[email protected]>:
>>
>>>       2. Unenforced type hinting:
>>
>> This almost happened in 5.4, but eventually got pulled. More interestingly, the *community*
>> rejected it because it is useless. See the comments at http://sebastian-bergmann.de/archives/900-Scalar-Type-Hints-in-PHP-5.3.99.html
>> for a good picture of why people hated this idea. Previous discussions on this mailing list also
>> point out that this idea would ultimately be a dead end (a very good catch by...someone...).
>>
>
> Hi, John
>
> Thanks for clarifying that way.
> I understand why some people want to have that ... to please really
> all people ... make a solution that fits for EVERYONE.
>
> But that would (on the other hand) cause way more confusion if you're
> working with different projects (using Sebastian Bergmanns example)
> ... one implementing this the way we would implement "Strict type
> hinting" - because that's what he wants ... and another one is
> implementing it as "Casting weak type hinting" ... and so on.
>
> I know that the user still has to add some code, but I don't like the
> fact to have additional type-hinting that's just doing nothing - and
> the user is then adding it if he wants.
>
> I'm still for the 3rd solution as it is most likely the current
> type-hint and is not that strict as the first solution. Just to have
> it consistent.
> What I like most here: All parameters that can be converted to the
> wanted format without loosing something are accepted, all other will
> stop the execution of the script.
>
> Bye
> Simon

Hi, All

Just to add an example why I want a more strictly type-check here as
we have in the current type-juggling:
http://www.brandonsavage.net/an-xss-vulerability-in-the-making/?utm_source=rss&utm_medium=rss&utm_campaign=an-xss-vulerability-in-the-making

Bye
Simon


Thread (13 messages)

« previous php.internals (#59001) next »