On Wednesday, 18 March 2015 at 00:04:26 UTC, Andrei Alexandrescu wrote:
On 3/17/15 3:58 PM, amber wrote:
On Tuesday, 17 March 2015 at 18:32:10 UTC, Almighty Bob wrote:
On Tuesday, 17 March 2015 at 12:52:01 UTC, Atila Neves wrote:
On Tuesday, 17 March 2015 at 10:31:06 UTC, Almighty Bob wrote:

This discussion happens often when discussing C++'s or D's `auto`. It doesn't matter what the type is, what matters is in the interface.

As for storing it:

auto foo = voldemort();

Oh, you meant in a struct?

struct Foo(T) {
 T thingie;
}

auto foo(T)(T thingie) {
  return Foo!T(thingie);
}

auto f = foo(voldemort());

Atila

That proves my point cost for the user just so the library designer
can group his type inside the function that returns it.

How many times is csvReader used vs how many times is it written. It it's 100 to 1, that's 100 times the cost to the user vs 1 x the cost
to the library author.

I cant help thinking it's like how when programmers first learn about design patterns they start trying to make everything they can into a
****ing singleton.

I have on a number of occasions wanted this:

struct S {
    Iota r; // ?? Would be nice, can it be done ??
}

if(something) {
    s.r = iota(10);
} else {
    s.r = iota(0, 10, 2);
}

import std.range;

void main()
{
    struct S {
        typeof(iota(0, 1, 1)) r;
    }

    S s;

    if(1) {
        s.r = iota(0, 10, 1);
    } else {
        s.r = iota(0, 10, 2);
    }
}

Also: there's a learn forum.


Andrei

Thank you!

I'll move onto D.learn :-)

bye,
amber

Reply via email to