A rationale for pure nothrow ---> @pure @nothrow (and nothing else changes)

Pelle Månsson pelle.mansson at gmail.com
Mon Mar 1 00:42:21 PST 2010


On 03/01/2010 04:00 AM, Michel Fortin wrote:
> On 2010-02-28 19:46:29 -0500, Pelle Månsson <pelle.mansson at gmail.com> said:
>
>> What about @curried? It (potentially) changes the way the function is
>> called, yet looks quite good as an @attribute.
>
> I'm not sure I understand how you expect a @curried attribute to be
> used. How would you call a @curried function?
>

@curried @pure add(int a, int b) {
     return a + b;
}

auto add2 = add(2);

assert(add2(2) == 4);
assert(add(4, 1) == 5);
assert(add(4)(1) == 5);

This is how I imagine it.

It already exists as a template, somewhere.



More information about the Digitalmars-d mailing list