Issue 1323

Mafi mafi at example.org
Sun Jan 9 06:17:13 PST 2011


Am 09.01.2011 14:56, schrieb Tomek Sowiński:
> Daniel Gibson napisał:
>
>> "restricted to n log(n)"? I think you meant just "log(n)"
>>
>> As far as I remember the last discussion, it was considered to allow it for
>> arrays of a constant size or with known (at compiletime) contents or something
>> like that.
>> But then again, that would feel kind of inconsistent (syntax is allowed for
>> fixed size arrays but not for dynamic arrays).
>
> If it's about compile-time, it can be done with template wizardry:
>
> x in [1, 5, 7]  ->   x.in_!(1, 5, 7)
>

Better yet, we could implement kind of Perl6 junctions. Just let 
anyOf(....) return a custom struct with overloaded operators which just 
do the operation on all operands and reduces the results with or (ie ||).

x == anyOf(3,4,5,42)
x == anyBetween(3, 12)

D is just great.


More information about the Digitalmars-d mailing list