23 Comments

User's avatar
vfig's avatar

i like this idea, with one modification: report byte positions in hex, e.g. 0x23ab5. it is more obviously not a line number (since we conventionally use decimal for line numbers); it is already commonplace to use hex for byte offsets in hex editors, debuggers, and so on; and as a side benefit, in large files it will end up being more compact anyway.

for tools talking to tools byte offsets is a clear win. but i would prefer to see tools reporting byte offsets in addition to line numbers, as a default (with switches if you like to choose only line numbers, or only byte offsets). because when a human has to be in the loop interpreting the result, line numbers have the convenience of being shorter (fewer errors in reading and typing them); easy to correlate by eye when an editor shows line numbers in the gutter (such as when having to make do with less-capable text editors that cant parse the output); and often easier to communicate to another human (such as when helping someone over screenshare, referring to line numbers is very valuable in a way that byte offsets cannot be).

Expand full comment
The Sandvich Maker's avatar

A small benefit for line numbers is that if I don’t have my editor hooked up to read compiler messages, it’s easier to type in a line number than a byte position, especially if I’m not looking at the errors and the code side by side. Perhaps that speaks more to a workflow problem though…

Expand full comment
21 more comments...

No posts