On Wednesday, 8 April 2015 at 18:08:36 UTC, Andrei Alexandrescu wrote:
On 4/8/15 10:04 AM, Dicebot wrote:
On Wednesday, 8 April 2015 at 16:56:12 UTC, Andrei Alexandrescu wrote:
Considering I am far from the only person having problems
with it in our team and such style is extremely common because of being easy - this can easily be one of most damaging language features in D in
terms of wasted developer time.

Again trying with ad populum. Not buying it.

I don't even slightly care about your opinion here. It is just another annoying custom style rule I have to deal with. Casual necessity for
actually getting work done with D.

I guess I deserve this for making my point as a jerk. I shouldn't engage in brief bickering when I don't have time. My point was: you'd need some detail to back up your claim about those wasted hours because I also work on a large D project at work with others and that hasn't been an issue, like, ever. We ended up just not adding the pesky "()"s simply because sitting down and deciding which deserves and which doesn't was a waste of time. E.g. front and empty shouldn't, but popFront should. Really no reason for it.

So, to be more specific, here is one of cases where it actually caused trouble in practice. Someone has originally written code that looked roughly like this:

while (something)
{
    // ...
    auto str = format("%s", parser.node);
}

Long time later I have been adding trace logs to that module and this has become akin to

while (something)
{
    log(parser.node);
    // ...
    auto str = format("%s", parser.node);
}

Which resulted in broken application. It took almost an hour to bisect all changed to trace the failure to this specifc line and realize that `parser.node` wasn't just trivial getter but method which actually advanced internal iterator to next node while returning current one.

Yes, this does seem to bother only some people and others actually enjoy omitting parens everywhere. But it comes up often enough to cause actual damage which makes aesthetical point much less convincing. I don't have any good statistics for how often it strikes or what kind of workflow is more likely to clash with such style - all I know that such cases happen, and happen often enough to not be dismissed as purely accidental.

Considering that following more permissive coding style does not actually give you any benefits than saving at most one pair of () per line, choice feels obvious. We don't currently have any strict style rules about this but general direction seems to be "mandatory () for last call in a call chain" with an exception for side-effect free trivial getters.

tl; dr: I can commonly be wrong in identifying the problem, evalutating its importance or proposing solutions but it feels offending when you suggest I don't actually have a problem at all. "Those are not the droids you are looking for" style ;)

Reply via email to