passing duck-typed objects and retaining full type information

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Nov 11 18:03:17 PST 2014


On Wednesday, 12 November 2014 at 01:50:07 UTC, Adam Taylor wrote:
> Adam Ruppe has an interesting example:

What that does is defer the type work to runtime, so a lot of 
type information is lost there too.

The big magic is that the wrapper object is a template, 
specialized for the compile time type, but once it is used it is 
still through an interface. This is similar to how the 
inputRangeObject+InputRange interface work in phobos 
http://dlang.org/phobos/std_range.html#inputRangeObject

Plain interface, templated implementation.


I don't really understand your question though....


More information about the Digitalmars-d-learn mailing list