Hi Lazare,

I'm a bit divided on your proposal.
On one hand I kind of like the simplicity of the syntax and the basic
idea behind it:

> (int?) $x
>
> which should be strictly translated to the following, without any way to
> change that behavior by any type casting overload system:
>
> is_null($x) ? null : (int)$x
>

But on the other hand, I'm not sure you should mix type casting and
the short if syntax (which is clearly what inspired the question mark
there).
This sort of makes me think you're really turning an (int) type
casting, into more of a (mixed) type casting... I don't really like
that! :)

Therefore I'm divided into thinking this is a cool idea, or if I'd get
so confused about this I would use it as much as the short if syntax:
$var = @$_GET['var'] ?: 'default';

(Which is never, btw!)

How about allowing *several entries* per type cast (since spaces are
allowed inside casts anyway, but could also be a semicolon or
something):

$int_or_null = (int unset) $x;

This could be usefull for other instances as (string null) or (bool
null) as well... Your thoughts?

Best regards,
~ Daniel Macedo

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

Reply via email to