Hi again,

On Wed, Mar 8, 2017 at 9:39 PM, Rowan Collins <rowan.coll...@gmail.com> wrote:
>
> I think it comes down to what you're trying to achieve: the language can't
> have pseudo-types for every possible combination of types, so if you want to
> detect integers as one case, and other things that can be converted to
> string as another, just perform your checks in the right order:
>
> if ( is_int($foo) ) {
> // ...
> } elseif ( is_stringable($foo) ) {
> // ...
> }
>

This is why I was concerned about the discussion becoming too broad -
it brings us (or me anyway) back to square 1, if not even out of
bounds. I wanted the ability to do "string or string object" checks
without multiple function calls, and now the suggested solution
doesn't do that.

I do agree that we can't have pseudo-types for everything, but can we
at least have meaningful ones? How would "stringable" be different to
"string", and what's the point of either of them if they accept every
other scalar type? We're having this discussion because outside of the
so called "strict mode", PHP's string type is just as meaningful as
"scalar", which makes it useless IMO.

Cheers,
Andrey.

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

Reply via email to