Differing levels of type-inference: Can D do this?

Chad J chadjoan at __spam.is.bad__gmail.com
Fri Jul 27 23:49:16 PDT 2012


Is there some way to do something similar to this right now?

void main()
{
   // Differing levels of type-inference:
   int[]       r1 = [1,2,3]; // No type-inference.
   Range!(int) r2 = [1,2,3]; // Only range kind inferred.
   Range       r3 = [1,2,3]; // Element type inferred.
   auto        r4 = [1,2,3]; // Full type-inference.
}

AFAIK it isn't: the type system is pretty much all-or-nothing about 
this.  Please show me that I'm wrong.


More information about the Digitalmars-d-learn mailing list