Contact Info

(for those who care)

Instant Gratification   



Fri, 28 Feb 2020

Did You Know That `gofmt` Emits Tabs(?!)

For God so loved his children that we finally have a programming language that has solved the tabs v. spaces debate!

This is truly exciting news! In recent years, I’d resigned my position to “use spaces everywhere” because of two justifications:

However golang bucks tradition in a particularly compelling way: Tabs are indeed control characters (increasing indent for control-flow modification), and due to near-ubiquitous use of gofmt, it’s also near-impossible to mess up(!).

If you control exactly the language, the compiler, and the formatter, it’s an incredibly compelling simplification to use tabs. Most editors “support them as expected” such that backspace and tab are commutative. This is effectively an upgrade for a moderate amount of people who were stuck backspacing over spaces.

Any misbehaving editor or stubborn user who uses spaces instead will simply get processed through the mold of gofmt … their transgressions are short-lived and forgivable.

Small victories may lead to large victories… with the tabs v. spaces debate definitively settled, mayhaps we finally can move on to figuring out Elastic Tabstops.

00:47 CST | category / entries
permanent link | comments?

Like what you just read? Subscribe to a syndicated feed of my weblog, brought to you by the wonders of RSS.



Thanks for Visiting!