Thoughts on versioning

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Oct 26 02:10:50 UTC 2021


On 10/25/21 10:04 PM, Andrei Alexandrescu wrote:
> On 10/25/21 9:41 PM, rikki cattermole wrote:
>>
>> Alternatively:
>>
>> mixin template StandardAlgorithmComparison() {
>>      Tuple!(Range1, Range2) mismatch(alias pred = "a == b", Range1, 
>> Range2)(Range1 r1, Range2 r2)
>>      if (isInputRange!(Range1) && isInputRange!(Range2))
>>      {
>>          for (; !r1.empty && !r2.empty; r1.popFront(), r2.popFront())
>>          {
>>              if (!binaryFun!(pred)(r1.front, r2.front)) break;
>>          }
>>          return tuple(r1, r2);
>>      }
>> }
>>
>> In std2.algorithm.comparison:
>>
>> mixin StandardAlgorithmComparison;
>>
>> In std.algorithm.comparison:
>>
>> mixin StandardAlgorithmComparison;
> 
> Good stuff. A great plus is that it works within the existing languages. 
> Other pros and cons?

Found a con:

- Cannot use local imports at all; the mixin must do all of its lookup 
in the top namespace.



More information about the Digitalmars-d mailing list