On 10/11/2018 04:36 AM, Dejan Lekic wrote:
On Thursday, 11 October 2018 at 06:58:08 UTC, Simen Kjærås wrote:

unittest {
    auto x = fun($); // What does it even mean?
}

After some reading through the whole thread I think his "$ idea" can only be applied to a RandomAccessRange (and similar) where the size can be known...

It already works with a RandomAccessRange:

void main()
{
    auto a = [1, 2, 3, 4];
    auto b = a.map!(x => x + 1);
    writeln(b[$-1]);
}

It's just that the compiler can't reach into the body of another function to determine what variable you're talking about to find the correct value to pass.

Reply via email to