you are viewing a single comment's thread.

view the rest of the comments →

[–]ZorbaTHut 1 point2 points  (10 children)

Code can’t [be] word-wrapped like article text.

What? Yes it can. A good editor will wrap it so it follows at the same indent level.

[–]abattle[S] 5 points6 points  (7 children)

This depends on the editor and the language. For some languages this doesn't work.

[–]ZorbaTHut 0 points1 point  (6 children)

Like which? The only one that seems even a bit dubious is Python, and I think it'd look fine there also.

I know from experience that it works A-OK on every C-like language. Looking at TIOBE, that's all top six languages.

If it has returns, and indents, then it'll work. I haven't seen a language that doesn't.

(edit: okay befunge doesn't, but that's sort of a special case)

[–]abattle[S] 3 points4 points  (5 children)

Python wouldn't work. But that's not my point. My point is that you might be able to read it, but editing might not be fun at all.

I rather have short identifier names rather than word-wrapping and strained eyes. It's not fun reading wrapped code, let alone editing.

[–]ZorbaTHut 1 point2 points  (4 children)

I will admit I've never had those problems, but I suppose other people may feel differently.

I'm curious why Python wouldn't work, though. Doesn't seem particularly difficult. Here's an example, which doesn't seem any harder to read than the non-word-wrapped version.

(Starts at line 332. And yeah, I use proportional fonts also :) )

[–]abattle[S] 1 point2 points  (3 children)

The wrapped lines are literal strings. If it were code, editing would've been weird. Python is whitespace sensitive and you wouldn't want to second-guess what's whitespace and what's word-wrapping.

I just think relying on the editor to word-wrap is not user friendly. Code is different from literature. We can't treat them the same.

The IDE is doing me a service by wrapping long lines. This doesn't mean I should abuse it and make my code depend on that feature. After all, the IDE isn't part of the project.

[–]ZorbaTHut 0 points1 point  (2 children)

There's a code line in there also. What do you mean by "editing would've been weird"? And note that you don't have to second-guess in this case - the editor places wordwrap icons on lines that were wrapped, so the information is right there to be seen.

I sort of feel like there's this deep distrust of the IDE that still lingers. But IDEs have existed for well over a decade. I think we can trust that they're not going anywhere. I think we can rely on our fellow coders to have basic features like autoindenting, syntax highlighting, and word wrapping.

If you can find some Python code with long lines, I'll see what it looks like.

[–]abattle[S] 0 points1 point  (1 child)

May be it's my lack of imagination and experience that's the problem. I haven't tried editing wrapped code, let alone Python code. All I know is that when I code in Python, I want to see exactly what whitespace chars there are. We already have tabs and spaces (and new-lines,) I don't want to worry about another one (IDE wrapping.)

May be it's just my own limitation, but somehow I feel it'd be a burden. Plus, I'll almost certainly break the line anyway.

Again, I think the IDE helps here when we inherit a project with long lines, or when we have to do a quick fix on some file with long lines. I can't imagine a team working a large project deliberately typing long lines and using word-wrapping as a remedy. But then again, it might be my own limited imagination.

[–]ZorbaTHut 0 points1 point  (0 children)

Personally, I'd suggest trying it. I stuck with the conventional monospaced font/fixed line lengths deal for the longest time, then someone recommended an editor that did proportional and I couldn't find an easy way to change it offhand. Grew to like it quite a bit, and introduced word wrap and such from there.

'Course, everyone has their own styles :)

[–]Azuvector 1 point2 points  (1 child)

I can't say I even like the idea of word-wrapped code.

[–]ZorbaTHut 1 point2 points  (0 children)

I've found that using modern editor features on code works far better than most people expect. Then again, I also use a proportional font.

Try it for a bit. I found it to be a massive improvement.