Compile-time Interfaces

Timon Gehr timon.gehr at gmx.ch
Tue Nov 29 07:58:18 PST 2011


On 11/29/2011 04:20 AM, Jesse Phillips wrote:
> On Sun, 27 Nov 2011 12:54:48 +0100, Timon Gehr wrote:
>
>> That is an overly restrictive interface because the element type is
>> fixed.
>>
>> The interface should be usable like this:
>> void foo(R : Range)(R input) { /* ... * / }
>
> void foo(T, R : Range!T)(R input) {} // ?

Templates are turing complete. This kind of matching is undecideable, 
and there exist cases where it is even ambiguous:

enum interface X(T){ } // what will T be deduced as?


More information about the Digitalmars-d mailing list