I've just fixed UFCS for the experimental type function branch

Stefan Koch uplink.coder at googlemail.com
Fri Sep 11 02:14:23 UTC 2020


On Friday, 11 September 2020 at 01:07:55 UTC, Paul Backus wrote:
> On Thursday, 10 September 2020 at 23:44:30 UTC, Bruce Carneal 
> wrote:
>>
>> Yes.  Of course in theory D templates are no more powerful 
>> than C++ templates but anyone who has used both understands 
>> that simplicity in practical use trumps theoretical 
>> equivalence.  As you note, it's not even close.
>>
>> It seems to me from forum postings and reports on the 
>> (un)maintainability and instability of large template heavy 
>> dlang code bases, that we're approaching the practical limits 
>> of our template capability.  At least we're approaching the 
>> "heroic efforts may be needed ongoing" threshold.
>
> I think the main difficulty of scaling code bases the rely 
> heavily on templates (either D or C++), as compared to other 
> kinds of generic code like OOP-style polymorphism or 
> traits/typeclasses à la Rust and Haskell, is that templates 
> themselves--not the code they generate when you instantiate 
> them, but the actual *templates*--are essentially dynamically 
> typed. In general, there's no way to catch errors in a template 
> until you "run" it (that is, instantiate it) and see what it 
> does.

Yes exactly.
templates are polymorphic, they can re-shape and what they do can 
be determined by the "call site".
Therefore they do not even have any meaning before being 
instantiated.

type functions on the other hand don't suffer from that.
They have a meaning.
Whether you call them or not.


More information about the Digitalmars-d mailing list