Eigenpoll : D wish list : Explicit out/inout/lazy 

Force specifying out, inout and lazy when calling a function as well as when specifying it. I.e.:

void foo(int bar, out char baz, inout bit qux, lazy void exp) { ... }

...

char x;
bit y = false;
int z = 0;
foo(4, out x, inout y, lazy z++);

Leaves no room for ambiguity like the "multiple return values" suggestion (unfortunately) does, but still clarifies syntax somewhat - how do you know whether foo(4, x, y, z++) does anything to x and y or not? Or will z really be incremented or not? With explicitness of out, inout and lazy it's obvious.

Plus when someone else changes the behaviour of
the foo() function (by adding lazy), the rest of the program will still compile, but produce different results without any error.


Report this item for cleanup