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

Ali Çehreli acehreli at yahoo.com
Sun Jul 29 12:32:10 PDT 2012


On 07/29/2012 10:22 AM, Chad J wrote:
 > On 07/29/2012 11:54 AM, Ali Çehreli wrote:

 >> ForwardRange!int r1 = inputRangeObject(map!"2 * a"(a1));
 >> ForwardRange!int r2 = inputRangeObject(map!"a ^^ 2"(a1));

 > IIRC, these are classes that come with all the typical runtime overhead,
 > right?

Yes, inputRangeObject() allows runtime polymorphism over compile-time 
polymorphism.

 > I intend to try and keep the awesome mix of potentially optimal code
 > that's also completely generalized. Introducing hard-to-inline vtable
 > calls into the mix would run against that goal.

Yes, usual runtime vs. compile-time polymorphism considerations apply.

Ali



More information about the Digitalmars-d-learn mailing list