mixin not overloading other mixins, Bug or feature?

Travis Boucher boucher.travis at gmail.com
Tue Dec 22 18:48:40 PST 2009


BCS wrote:
> Hello Travis,
> 
>> float func1(float[2] v) { return v[0]; }
>> float func1(float[3] v) { return v[0]; }
>> template Test (size_t S) {
>> float func2(float[S] v) { return v[0]; }
>> }
>> mixin Test!(2);
>> mixin Test!(3);
>> void main() {
>> float[2] a2;
>> func1(a2);
>> func2(a2);
>> }
>> Here the call to func1 is fine, but the call to func2 results in a
>> conflict.
>>
>> Test!(2).func2 conflicts with unit.Test!(3).func2
>>
>> This was tested with ldc (dmd 1.051).
>>
>> Is this a bug or a "feature"?
>>
> 
> IIRC it's a fature. I forget where, but I recall reading that they don't 
> overload.
> 
> 

I know they don't, I am just wondering why.  Is it a side 
effect/oversight of the implementation (misfeature), something that is 
suppose to work (bug) or is there a concrete reason why (feature).




More information about the Digitalmars-d mailing list