Hi Daniel,

No, it is not inspired from the short ternary operator. It's a rather
common conversion. C# has a similar notion of nullable types (with totally
different mechanics however). By the way, in this particular area PHP's
type system is more sound than that of C#, because null is not just a
special value of any type but it is a value of a separate null type. Kudos
to the original designers for this choice.

Your proposal for (int unset) is not very far away from what I propose. In
PHPDoc, and in many IDEs, there are often mixed types like these:

int|string
int|null
string|bool|null
bool|null
DateTime|null
...

Of all different combinations, the ones between a type and null are very
usual. So, I propose "int?" as a shortcut for "int|null". In that sense, it
is totally equivalent to "int unset" that you say. Personally, I find
"unset" not proper for this case, because it is not going to unset anything
that is not already null.


 > BTW: Order would equal what is type casted OR simply accepted!

Do you have any examples where this could be useful?


Lazare INEPOLOGLOU
Ingénieur Logiciel


2012/3/5 Daniel Macedo <admac...@gmail.com>

> > This could be usefull for other instances as (string null) or (bool
> > null) as well... Your thoughts?
>
> Typo! The examples should read (string unset) and (bool unset)
>
> BTW: Order would equal what is type casted OR simply accepted!
>
> ~ Daniel Macedo
>

Reply via email to