Does D have too many features?

H. S. Teoh hsteoh at quickfur.ath.cx
Sun Apr 29 19:34:39 PDT 2012


On Sun, Apr 29, 2012 at 11:18:12PM +0200, deadalnix wrote:
[...]
> C don't have out parameters as D have. C have pointer to do kind of
> out parameters, and D have pointers too, this is a non issue.

I argue that using 'out' vs. a pointer is a good thing, because it
clarifies intent. When you see a pointer, it's far from clear whether
it's an input parameter, an output parameter, or both.

More and more, I'm leaning towards the opinion that all code should
reveal intent, preferably in a language-supported way. Unclear intent is
what leads to subtle bugs caused by people calling functions with wrong
assumptions. (You'd think this should be a non-problem with programmers,
who are presumably smart enough to figure things out without being told
in the face, but I've seen too much "enterprise" code by now to not be
cynical about it.)


T

-- 
Heuristics are bug-ridden by definition. If they didn't have bugs, they'd be algorithms.


More information about the Digitalmars-d mailing list