On 13/07/2012 13:31, Jonas Drewsen wrote:
On Friday, 13 July 2012 at 09:49:22 UTC, monarch_dodra wrote:
I don't know much about C#, but in C#, isn't EVERYTHING a reference
type? Meaning it always makes sense to check if "myobject is null".

I'm still no expert in D either, but what would(should) happen if you
tried to call ?: or ?. on a value type? Writing "s is null" gives
"Error: incompatible types for ((s) is (null)): 'S' and 'typeof(null)'"

I'd guess that:
*"s ?: S(5)" would give a compile error, since it the call makes no
sense?
*"s?.someFunction" would simply resolve as "s.somFunction"?
- This could avoid problems in templates that want to use ?.

The operators *look* convenient, but isn't there a risk of ambiguity
for D? But again, I'm not expert in either languages.

Regarding the ?: operator I agree with Andrei that is should be handled
by a coalesce() function instead.


Due to lazy being broken, this cannot be @safe, pure or nothrow.

Reply via email to