Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Solution to the tabs vs. spaces debate?

Name: Anonymous 2009-06-07 19:51

Name: Anonymous 2009-06-07 19:56

The correct answer to the debate is: it doesn't matter as long as it's consistent, just don't mix them up like a retard

Name: Anonymous 2009-06-07 19:59

>>1
wake me up when he pathces nano

Name: Anonymous 2009-06-07 20:02

Makes sense. I just use tabs pretty much like this, and don't worry about alignment. What I'd like to see is a solution that makes proportional fonts as easy to indent accurately with spaces as a fixed-width font. My idea is to take the width of each space from the character directly above it. That way you could use space(or tab)-based alignment with a nice font.

Name: Anonymous 2009-06-07 20:08

>>4
Who the fuck uses proportional fonts when programming? Why not use fucking MS Word as your text editor while your at it.

Name: Anonymous 2009-06-07 20:09

>>4
Like Comic Sans MS, right?

I program in Haskell, ergo I have to use spaces.

Name: Anonymous 2009-06-07 20:24

It's a bit strange how at the end of the video he says to visit his website, despite the fact that you can only watch the video from his website...

Name: Anonymous 2009-06-07 20:25

>>7
Do you also think it's strange how eval calls apply and apply calls eval?

Name: Anonymous 2009-06-07 20:25

>>8
i shat bricks

Name: Anonymous 2009-06-07 20:42

Name: Anonymous 2009-06-07 20:46

>>10
Looks like shit.

Name: Anonymous 2009-06-07 20:47

>>10
Tell me who's forcing you to use this. I'll avenge you.

Name: Anonymous 2009-06-07 20:50

>>10
You don't seem to be closing the file if channels != 1. I knew this would be the case as soon as I saw that you
1. Was handling a file, &&
2. Used proportional fonts for coding.
I've never used Acme, but can't you set it to use a proper programming font?

Name: Anonymous 2009-06-07 20:59

>>11
Enjoy your blurtype.
>>12
It was Rob Pike. :(
>>13
Good catch. I'm not used to this passive-aggressive language. And yes, you can see the proper programming font right there.

Name: Anonymous 2009-06-07 21:08

>>14
you can see the proper programming font right there.
*sigh* I suppose trying to get you to properly check your memory allocations for success would just be a lost cause.

Name: Anonymous 2009-06-07 21:15

>>15
So I can do what about it? I'm perfectly happy to segfault here if such an unlikely thing occurs.

Name: Anonymous 2009-06-07 21:33

>>16
sometimes it makes more sense to tell the user "i can't get enough memory to do that" and then ask the user what to do instead of just exiting.
how would you like it if your text editor crashed if a regular expression search caused it to use too much memory?

Name: Anonymous 2009-06-07 22:02

>>16
Fail gracefully.

>>1
I very much don‘t like having to indent the first parameter to a function to align the rest of them with that. It just feels wrong. Otherwise, I guess they‘re not too bad, but still far from perfect.

Another problem is that if I insert a blank line (or a comment line) between my nicely-aligned text, it fucks it up (I‘ll have two blocks of text which are both internally nicely-aligned, but not nicely-aligned with each other.)

Conversely, I would sometimes have to insert a blank line in order to please it. Let's presume that GHC were modified to change Haskell‘s layout rule to use elastic tab stops instead. Then let‘s say I have

f x = let a = b + b
          b = c + c
          c = d + d
          d = x + x
      in a + a

         
I‘d have to insert a blank line between the "d = x + x" and the "in a + a", just to please this thing. You gain some convenience, but you end up with less control. I suppose you could put this case down to Haskell‘s layout rule being retarded, though.

>>6
Well, you can use tabs in Haskell, it's just retarded. A few editors behave as the Haskell layout rule expects (tab aligns to nearest multiple of 8) — GNU nano and Windows notepad are two.

Name: Anonymous 2009-06-07 22:04

The solution is to just use tabs so everyone can choose how many spaces one wants an indentation level to be.
That and not use tabs for formatting. Aligning lines and the like should be done with spaces to guarantee that code looks good no matter how wide a tab is.

Name: Anonymous 2009-06-07 22:28

>>19
If by tabs you mean spaces then I agree with you completely. Unless you're using a text editor from the dinosaur era, it should have an option to automatically convert tabs into glorious spaces.

Name: Anonymous 2009-06-07 22:38

>>18
Well, you can use tabs in Haskell, it's just retarded. A few editors behave as the Haskell layout rule expects (tab aligns to nearest multiple of 8) — GNU nano and Windows notepad are two.
That only matters if you're mixing them with spaces, and there's no reason to do that.

>>20
Arbitrary space indents are cancer.

Name: Anonymous 2009-06-07 22:55

>>17
Come on. What is the user going to do without allocating any memory? The proper behaviour is to crash. This isn't like disk space, where you can run perfectly well for a few moments until you delete something. The question is whether to crash with a specific message or an obtuse one. Considering all hell is going to break loose if you run out of memory, the user is unlikely to be confused.

Name: Anonymous 2009-06-07 23:10

As the article's author implied, we should really be using Microsoft Excel to write code. That way I can finally write a 2x2 conditional grid instead of repeating a nested if twice.

                    if (tall == true)     else
                 +-------------------+------------+
if (wide == true)|    goAround()     |  goUnder() |
                 +-------------------+------------+
else             |    goOver()       | goThrough()|
                 +---------------------------------

Name: Anonymous 2009-06-07 23:27

>>22
if allocating 10MB of memory fails, it may still be possible to do something that takes less than 10MB of memory, like saving a file to disk instead of just crashing and discarding whatever the user was doing.

>>1
the real solution is to stop using indentation and just use alignment.

Name: Anonymous 2009-06-07 23:43

>>23
(void (*()[4])){ goAround, goUnder, goOver, goThrough }
 [!tall + 2*!wide]();

Name: Anonymous 2009-06-07 23:53

>>25
(void (*()[4])){ goAround, goUnder, goOver, goThrough }
 [!tall + (!wide)<<1]();


BIT SHIFT OPTIMIZED

Name: Anonymous 2009-06-07 23:53

>>22
The error still has to be passed up to the calling function, so it gets the chance to do any necessary cleanup and decide whether to recover or pass the error further up. The decision to just give up and crash should be taken at the top level. If you are coding in a language with no exceptions, this means you are now checking every function call for success, manually.

Name: Anonymous 2009-06-08 0:47

>>25-26
error: 'type name' declared as function returning an array
did you mean
(void (*[2][2])(void)){{ goAround, goUnder }, { goOver, goThrough }} [!w][!t]();
?

Name: Anonymous 2009-06-08 0:48

>>28
oops, that should be:
(void (*[2][2])(void)){{ goAround, goUnder }, { goOver, goThrough }} [!wide][!tall]();

forgot to change those two back when i copied and pasted it.

Name: Anonymous 2009-06-08 5:41

There's some EXPERT C PROGRAMMING going on in this thread lol

Name: Anonymous 2009-06-08 6:53

>>30
``lol'' is not the replacement for a period.

Name: Anonymous 2009-06-08 8:42

>>31
#define lol .

Name: Anonymous 2009-06-08 9:31

Try it right now

This browser does not have a Java Plug-in.
Get the latest Java Plug-in here.


In some browsers, pressing tab will switch to the next focussable part of the page, rather than sending the event to the applet. If that happens to you, try copying a tab character and pasting it. If that's too annoying or you have any other problems, you can download the jar file (source code included) and run it outside the browser instead.

Name: Anonymous 2009-06-08 10:24

Am I the only who uses 2 space tabs?

Name: Anonymous 2009-06-08 13:04

>>32
Now you're plenking .

Name: Anonymous 2009-06-08 15:26

There's some of us that never considered it a problem or a legitimate debate.

Name: FrozenVoid 2009-06-08 15:30

I use neither because they're mostly useless(except Python) and you can compact lines with ;.


_______________________________________________
http://xs135.xs.to/xs135/09042/av922.jpg
orbis terrarum delenda est

Name: Anonymous 2009-06-10 10:58

>>37
A fatal error occured!
Please post less often!

Name: Anonymous 2009-06-10 16:00

>>36
Translation: some of us have never needed to work on code written by others.

Name: Anonymous 2009-06-10 16:06

>>39
why are you replying to the sage faggot?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List