[COFF] What languges would you like to learn?

Larry McVoy lm at mcvoy.com
Wed Dec 25 04:04:20 AEST 2019


On Tue, Dec 24, 2019 at 05:50:35PM +0000, Michael Kj??rling wrote:
> On 24 Dec 2019 08:35 -0800, from lm at mcvoy.com (Larry McVoy):
> > There is a lot to be said for programming in the most simple way possible,
> > we had a saying at my company "Write code so it is the most readable.
> > Because 6 months from now you'll not remember it, it will be like reading
> > someone else's code".
> > 
> > Code is write once, read many.  Optimize for that.
> 
> Same reason why I'll sometimes add "unnecessary" parenthesis to
> expressions. If you parse the expression and know all precedence rules
> by heart (sometimes including the more esoteric ones; quick now,
> imagining you don't do a lot of bit-banging, does `^` have precedence
> over `&`? the existence of the joke "goes to" `-->` operator is just
> icing on the cake here), those can technically be unnecessary; but
> having them often adds _clarity_ that helps convey intent (yes, I
> really meant to do this) and meaning (this is how to parse the
> expression), at the cost of a totally insignificant increase in build
> times. To me, that's an appropriate trade-off.

We could work together, I do exactly the same thing.

> That said, I'd rather read code that makes good use of language
> features such as, say, the conditional operator (`?:` in C-derived
> languages), than code that does the same thing using a bunch of
> if/else constructs and temporary variables, just because someone might
> not know what `x?y:z` in the middle of a statement means. That latter
> is something that can be solved by a five-minute explanation when they
> encounter it, instead of burdening everyone who reads the code with
> extra crud just in the event that someone doesn't know about the
> conditional operator. Now, that might not be (hopefully was not) what
> you meant, but to me, "write readable code" should not be taken to
> mean "write code that does not require knowledge of the programming
> language to read", as sometimes happens at the other extreme end of
> the scale.

Again, 100% agree.


More information about the COFF mailing list