> You know, “int”, “float”, “string” etc. aren’t currently reserved words. We 
> could add functions, or even make them reserved words and add internal 
> functions (à la isset), so int(‘2’), float(‘2.0’), string(‘test’) etc.
>
> Or perhaps class-like constructors? $a = new int('2'); ? Would kinda make 
> sense given some people want to add methods to primitive types.

+1

$int     instanceof Int
$float  instanceof Float
$num  instanceof Numeric
$bool  instanceof Boolean
$str     instanceof String
$array instanceof Array

This makes it possible not to use the is_*() functions.
It is desirable to conduct instanceof fully consistent with behavior
hinting casts, it would be logical and correct.
Just wanted to be able to use these classes (or interfaces) to create
their objects, these objects would pass inspection in hinting casts.

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

Reply via email to