just an idea (!! operator)

monarch_dodra monarch_dodra at gmail.com
Fri Jul 13 02:49:21 PDT 2012


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.


More information about the Digitalmars-d mailing list