Top
Best
New

Posted by MaxLeiter 6 days ago

Formatting code should be unnecessary(maxleiter.com)
350 points | 476 commentspage 5
burnte 5 days ago|
Whitespace being important is literally the reason I don't use Python. I'm absolutely TERRIBLE with whitespace in my code, I do not indent like most people, I indent a lot less frequently. I learned coding on TRS80 Model 100 basic, and in DOS with Borland IDEs. Bytes mattered! :D
jaimebuelta 5 days ago||
I think that formatting code is necessary to maintain a codebase that's used by multiple people and keep some consistency. It's very confusing to have different standards in different parts of the same code.

Code should be generally written so it's easy to read.

Tractor8626 5 days ago||
Author advocates for a thing they never used.

"It must have been good because Grady Booch says so".

dark-star 5 days ago||
In most languages (other than e.g. Python), formatting code is actually unnecessary...
amdivia 5 days ago||
I assume that's something similar to the Unison [1] programming language

https://www.unison-lang.org/

fridental 5 days ago||
Typing keywords letter by letter is unnecessary too. Think about ZX Spectrum keyboard allowing you to type BASIC keywords with just one key press.
whartung 5 days ago||
This was actually a potential problem, at least on Commodore machines.

On those machines you were able to abbreviate keywords.

At the same time, they support full screen editing. That meant you could just cursor up over some code, make changes, hit enter, and the changes would take place.

However, when using the abbreviations, it was possible to create lines that were too long. I don't recall the specifics, but there was a line limit for BASIC input. Lets say it was 80 chars (for discussion).

Using abbreviations (like ? for print) and you could end up with a line that would LIST for more than 80, but if you tried to change it with the screen editor, the lines would be too long, and truncate silently.

So you had to be cautious with your use of the abbreviations.

Cockbrand 5 days ago|||
Similar, and maybe more related to the article's topic: Commodore BASIC also saved the commands as tokens, so you could enter abbreviated commands like

  10 ? "Hello"
  20 gO 10
and a LIST command would yield

  10 print "Hello"
  20 goto 10
So saving commands as tokens in memory and formatting them on output was somewhat common back then.

The speccy was more advanced in terms of this (as mentioned in the parent comment), and it had the better BASIC for sure.

cluckindan 5 days ago||
Or think about the M (aka MUMPS) language, which allows you to type just the first letter(s) of a keyword and considers it valid syntax.

Imagine Java if you could…

    na com.mycompany.myapp;
    
    pu cl MyClass {
      pro sta i = 42;
    
      pri fi ch[] MAGIC = ['a', 'b'];

      pu sta v main(String[] args) {
        OtherClass otherClass = n OtherClass();
        f (i i = 0; i < MyClass.i; i++) {
          otherClass.hex(i, this.MAGIC);
        }
      }
    }
gethly 5 days ago||
I am quite thankful for Go. It ticks so many boxes. Having native gofmt and simple syntax means I can easily read anyone else's code instantly.
komali2 5 days ago||
Formatting code is unnecessary. You write it however you want, then run the lint fix command and prettier command, commit, and move on.
BlueUmarell 5 days ago||
Ohhh, a topic about code formatting

<picks pop-corns>

grim_io 5 days ago|
I came prepared to fight the author, but I left in agreement.

Yes, we should expect better from our tools and languages.

More comments...