Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

Please note: I considered posting this as an answer to the initial thread, but I feel that this question warrants its own, targeted answer set. There's also a follow-up tag, so I figure I'm above the board.

I'll tell you straight-out what I hate about line numbers: they poison my clipboard. Many sites have numbered code blocks that translate to my clipboard. I can't STAND when that happens! What's worse, webmasters who have users stripping numbers from code simply can't be told.

On the other hand, I also think find it very frustrating that stackoverflow, being a programming Hall-of-Famer and all, hasn't implemented a simple yet eloquent code referencing system. We can accommodate concerns like the one I've mentioned above, and I trust users to follow the FAQs and tool tips, and not post lengthy code blocks.

What problem does having numbered code blocks solve, and why is it worth the effort to implement? I like to keep my tabs and programs down on my clunky old POS PC. It's irritating to have to open something new up and clear my clipboard. The only other option is to alter local style sheets or count--1, 2, ..., 25, ..., I lost my place, 1...--just to get a line number!?!! WHAT?!

Hey..., wouldn't it be cool to have deep embedding at StackOverflow, so that users could link directly to relevant lines in code blocks? Save us all some time.... But before I get histrionic, how about we get together around an old standard (see the link):

What is your opinion?

Would you rather have an low-resource function allowing users to toggle line numbers attached to code blocks or would you rather not? Please, explain your choice so that we can all think on and respond to some solid reasoning.

Thank you in advance, for your creative and unique responses!

share|improve this question
Next time somebody asks me what formatting options are available on SE sites, I'll just show them this question – Michael Mrozek Oct 14 '11 at 16:08
I still think it's a nice idea, Mikie. – Wolfpack'08 Oct 15 '11 at 3:58
up vote 5 down vote accepted

Would you rather have an low-resource function allowing users to toggle line numbers attached to code blocks or would you rather not?

No, I'm very strongly against this.

Think about the consequences. If you enable line numbering, even only in a toggled way, and people start referring to line numbers in comments or answers …

  • What about the users that don't have line numbers enabled? How are they going to know what you're referring to with "In your line 5, you yak the bar too many times". Or: "Your line 6 has a syntax error!".

  • This makes it necessary for them to enable line numbers as well, even if they don't want it, because they have no other means of understanding what you're referring to.

  • If posts are edited, changing code, adding stuff, deleting stuff, how are you ever going to make sure that …

    • all answers to a question are still intact? Do you want to maintain – let's say – 10 answers that refer to line numbers in a question that is edited?
    • all comments are still intact? You can't edit comments. By editing a post's code, you break comments that refer to line numbers.

Summarizing: You would therefore need to educate people in using more than just line numbers to refer to given parts of code. How are you going to do that?

share|improve this answer
If they don't know what line you're referring to, they can toggle the numbers.... People actually refer to line numbers very often, already. It would be more convenient for people to be able to toggle numbers and see what people are referring to, rather than needing to go off-site to figure it out. The 'toggle' wouldn't be question-by-question, it would be code block-by-code block. I'll see if I can develop a working example. – Wolfpack'08 Oct 14 '11 at 16:39
I really do like what you've said about educating people to refer to code with more than just line numbers. It's a very useful exercise that helps people to better understand code. Thank you. – Wolfpack'08 Oct 14 '11 at 16:41
@Wolfpack'08 I'm not that active on SO, so I haven't seen line number comments yet. It's surely not a big thing to implement this with a userscript, and you can always publish it on Stack Apps :) – slhck Oct 14 '11 at 16:45
Hey, this is a great site. I didn't notice it here, before. – Wolfpack'08 Oct 15 '11 at 2:16
@slhck But what if line numbering was not optional... surely that wouldn't be that bad. – lkjhgfdsa Nov 5 '13 at 20:55
@likeasomebody True. There are many things that Stack Exchange could make optional, but (unfortunately, IMO) they have a very strong opinion against user preferences of any kind. A userscript to enable it would probably work well. – slhck Nov 5 '13 at 21:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .