Nick Sabalausky:
On 4/29/2014 9:38 PM, Narrator wrote:

fn map<'r, B>(self, f: |A|: 'r -> B) -> Map<'r, A, B, Self>


That looks like line noise.

In D there is a lambda syntax:

auto F = (in int x) => x ^^ 2;
void main() {
    int y;
    auto G = (in int x) => x + y;
    pragma(msg, typeof(F));
    pragma(msg, typeof(G));
}


That code contains the types (the pragma output is a little different):

int function(in int) pure nothrow @nogc @safe
int delegate(in int) nothrow @nogc @safe


An alternative syntax can be similar to the way you write D lamdas:

(in int) pure nothrow @nogc @safe => int
(in int) nothrow @nogc @safe ==> int

(I am not suggesting to introduce this syntax to D because its an useless duplication, but I find it a bit better.)

Bye,
bearophile

Reply via email to