The Expressiveness of D

Gary Whatmore no at spam.sp
Tue Nov 2 07:08:30 PDT 2010


Torarin Wrote:

> > // these don't work - why?
> > //  auto b = [new B, new C];
> > //  auto c = { return [1: new B,2: new C]; };
> 
> That seems to be just a matter of improving the compiler to make it
> find the common type. I don't think there's anything in the language
> stopping that from working.

This is another one of those low priority issues. Never seen this kind of code in practice. These examples are highly synthetic and come from advocates of "clean" simple languages. "No corner cases" - does it matter if the language is full of broken corner cases if the practical real world code just works? D isn't nowhere near that bad.

Other than that, I'm quite sure compiler construction isn't that straightforward. You can't use the same type deduction code of "? :" in this context. A functional kid might say, if you have infer(a,b) and reduce(), you can solve this, but you have to consider metaprogramming and all complex stuff in D. Otherwise this would work already.


More information about the Digitalmars-d mailing list