Having seen both options, I would vote neither for the following reasons:

With strict "hinting", give it about a year when some major frameworks
would have adopted this, and not just for the functions that would
actually require it; they would go all the way in the name of
consistency. When that happens, the point of "those who don't care can
just ignore it" will be an utter falsehood.

On the other hand, auto-casting used to be my favourite until I
glanced over the conversion table; it's not just regular casting, it
has different rules. I wouldn't want to be the one going over that
table when writing code against a certain API, I should only need to
see the documentation.

Though, strict hinting, being the most predictable, in my mind would
go like this:
1) by all means, prefix your function arguments with the types you want
2) upon checking the arguments, raise an E_STRICT notice upon type mismatch

Wouldn't that fall exactly in the definition of strict hinting? It's a
hint by definition and the notice is E_STRICT. And let's be honest
here, API developers should - in most cases - know better what they're
doing than the API consumers. Therefore, if certain variables might
cause issues, just check the type, cast it, throw an exception if you
really need to.

The joy of working with PHP is that types aren't the most important
thing in most cases and I would hate for PHP to later be known as the
weakly typed language that couldn't.


On Fri, May 28, 2010 at 8:57 AM, Philip Olson <phi...@roshambo.org> wrote:
>
> This thread needed post #100 so here goes:
>
> - We want both options, can we accept this and focus on making it happen?
> - I love using === but am okay with others ab^H^Husing ==
> - The strict type hinting patch now includes 'numeric' and 'scalar' type hints
>
> Regards,
> Philip
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
--
Tjerk

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to