Article about problems & suggestions for D 2.0

Timon Gehr timon.gehr at gmx.ch
Mon Aug 29 11:39:22 PDT 2011


On 08/29/2011 07:44 PM, Martin Nowak wrote:
> On Mon, 29 Aug 2011 18:55:56 +0200, Andrej Mitrovic
> <andrej.mitrovich at gmail.com> wrote:
>
>> Oh man wouldn't it be cool if we could use this syntax like this:
>>
>> void test(R1:isInputRange, R2:isForwardRange)(R1 r1, R2 r2) {}
>>
>> I'm not sure how that would work with multiple constraints or
>> constraints that need comparisons, e.g. ElementType:
>>
>> void test(R1:isInputRange && ElementType == int, R2:isForwardRange)() {}
>>
>> Just throwing ideas for D5 there.. lol.
>
> Well, can you come up with a useful syntax for
> void put(E, R)(R r, E e) if(is(E : ElementType!R)) {}
> et.al.
>
> Otherwise having another syntax which put the sometimes heavy template
> constraints on the exact opposite
> side of the function signature is not too tempting.

void put(E: ElementType!R, R)(R r, E e) {}


More information about the Digitalmars-d mailing list