> for the record this was proposed (as an idea) previously with the exact
same syntax(the earlies mention I could find in my mailbox was > from
Derick from 2009: http://comments.gmane.org/gmane.comp.php.devel/57653 but
I remember seeing it every time when this
> discussion happens).
> If somebody is interested in previous attempts/discussion on the topic,
here are some links for starters:
>
http://nikic.github.io/2012/03/06/Scalar-type-hinting-is-harder-than-you-think.html,
http://blog.ircmaxell.com/2012/03/parameter-type-casting-in-php.html,
https://wiki.php.net/rfc/parameter_type_casting_hints,
https://wiki.php.net/rfc/typechecking

Ferenc Kovacs, thanks for referencing it up! I wasn't aware this proposal
was so recurrent. Anyway, this seems to be the most interesting solution we
could have now without compromise against the long awaited strict type
check in the future. One big plus is that "parameter type casting" wouldn't
offer any bc break and therefore is much easier to pass.

Backed up by all the references Ferenc Kovacs listed, I'd like to
suggest Andrea
Faulds to use parameter type casting syntax for this RFC.

Regards Márcio Almada
https://github.com/marcioAlmada


2015-01-01 13:36 GMT-03:00 Ferenc Kovacs <tyr...@gmail.com>:

>
>
> On Thu, Jan 1, 2015 at 4:59 PM, Marcio Almada <marcio.w...@gmail.com>
> wrote:
>
>> The battle between strict type declarations vs coercive has been here for
>> a
>> while. My problem with coercion in detriment of strictness is
>> that sometimes you DON'T WANT TYPE CASTING AT ALL. This new feature would
>> create serious impediments. So I wonder if we couldn't have both (strict
>> and coercive types declarations) and leave the current proposed type
>> hinting syntax reserved for strict type declarations? Like in:
>>
>>     function(int $a, (int) $b) {
>>          // $a will be strict
>>          // $b will be type casted
>>     }
>>
>> This way we can actually choose when to cast and when to be strict and
>> both
>> features could be voted independently without affect each other possible
>> future adoptions.
>>
>
> for the record this was proposed (as an idea) previously with the exact
> same syntax(the earlies mention I could find in my mailbox was from Derick
> from 2009: http://comments.gmane.org/gmane.comp.php.devel/57653 but I
> remember seeing it every time when this discussion happens).
> If somebody is interested in previous attempts/discussion on the topic,
> here are some links for starters:
>
> http://nikic.github.io/2012/03/06/Scalar-type-hinting-is-harder-than-you-think.html
> http://blog.ircmaxell.com/2012/03/parameter-type-casting-in-php.html
> https://wiki.php.net/rfc/parameter_type_casting_hints
> https://wiki.php.net/rfc/typechecking
>
> --
> Ferenc Kovács
> @Tyr43l - http://tyrael.hu
>

Reply via email to