out/inout/lazy at call site

Jakub Schmidtke tanis at aster.net.pl
Wed Jan 3 16:08:23 PST 2007


I started learning D language and I have a question - why doesn't it use 'out'
the way C# does?
I have found topics about this feature (or a problem), but there was no real
discussion.
So my question is, why is it that way?
I think, that having mandatory 'out' or 'inout' or 'lazy' in front of
parameter (at call site)
which is treated in a different way than just to pass a value is a really good
way to avoid bugs.
Especially in group project, when someone decides that it would be a really
good idea to change
one of the parameters to 'lazy', it would be nice to have a compile error,
rather than
strange bug in the code, when something stops working and nobody knows why -
the bug similar
to having something like assert(a++); in Java - when assertions are switched
off, program stops
working properly. The difference is that 'assert' is known to be 'suspicious',
and in D every function
may behave differently than we expected (and worse - it may change the way it
treats its arguments).




More information about the Digitalmars-d mailing list