switch()

Walter Bright newshound2 at digitalmars.com
Mon Feb 17 20:02:39 PST 2014


On 2/17/2014 6:54 PM, Manu wrote:
> Me too, but you don't feel this is basically a hack?

I see nothing hackish about it. After all, there's a reason D does not enforce 
whitespace.


> About half of that text is repeated cruft, and there's no precedent for
> formatting well-structured code like that anywhere else in the language.
> How long would you say you spend on average fiddling with the tabulation?
> I am known to spend minutes pressing the space bar, trying to make it line up
> and look nice. And then invariably, some other case comes along, with a slightly
> longer identifier name, and you have to work your way up shifting everything
> around against with a bunch more spaces.. pollutes source control history, etc.
> And then that case with the REALLY long identifier name comes along, and you end
> out with so many spaces surrounding all the other cases, that it becomes
> difficult to associate which line matches which case, so then you think to
> yourself, "this one long case is ruining my code, maybe I should break the
> pattern and fall this long one onto it's own line below...", and then you're
> just wasting time, pushing the spacebar key, trying to work around something
> that shouldn't have been an issue in the first place.
> Often enough the break statements end up far off the right hand side of the
> screen due to that one long statement in the sequence; do you line them all up
> religiously far to the right? Or do you make an exception for that one long
> line, allowing it to span beyond the 'break' line, and keep the rest lined up
> nearer to the code they terminate?
> Tell me this doesn't happen to you? Surely I'm not the only one that faces this
> sort of conundrum frequently when I try and use switch? :)

Shirley you're joking. If that's the hardest problem you face programming in D, 
I am well satisfied that D is a great design!



More information about the Digitalmars-d mailing list