Article about problems & suggestions for D 2.0
Martin Nowak
dawg at dawgfoto.de
Mon Aug 29 10:44:58 PDT 2011
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.
More information about the Digitalmars-d
mailing list