7

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 find it very frustrating that Stack Overflow, 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 Stack Overflow, 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.

2
  • 5
    Next time somebody asks me what formatting options are available on SE sites, I'll just show them this question Commented Oct 14, 2011 at 16:08
  • I still think it's a nice idea, Mikie. Commented Oct 15, 2011 at 3:58

1 Answer 1

7

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?

6
  • 1
    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. Commented Oct 14, 2011 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. Commented Oct 14, 2011 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
    Commented Oct 14, 2011 at 16:45
  • Hey, this is a great site. I didn't notice it here, before. Commented Oct 15, 2011 at 2:16
  • @slhck But what if line numbering was not optional... surely that wouldn't be that bad.
    – lkjhgfdsa
    Commented Nov 5, 2013 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
    Commented Nov 5, 2013 at 21:02

You must log in to answer this question.

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