On 4/19/2011 7:30 PM, spir wrote:
And what about requiring "lazy" (and "ref") at the call site; I mean in
the long term? I find this very sensible.

Denis

I wouldn't mind this for "lazy" but would argue heavily against it for "ref". ref parameters are both more frequently used and less surprising than lazy parameters and usually the name and usage of the function give a stronger hint about what it does. Secondly, functions may modify their input parameters in surprising ways without ref, if the parameters contain indirection (for example, classes, pointers, arrays). Furthermore, requiring ref at the call site would break uniform function call syntax. For example:

void popFront(T)(ref T[] array) {
    array = array[1..$];
}

void main() {
    auto foo = [1, 2, 3];
    foo.popFront();
}

Reply via email to