Michał "phoe" Herda is a user on functional.cafe. You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here.

Tag urself on lisp indentation style:

;; I'm afraid of passing 80 characters
(proc1
arg1 arg2
(proc2
arg1 arg2
(cond
[(foo)
(bar 'baz 'quux)]
[else
(beep boop 'bop)])))

;; Everyone has wide monitors these days anyway right?????
(proc1 arg1 arg2
(proc2 arg1 arg2 (cond [(foo) (bar 'baz 'quux)]
[else (beep boop 'bop)])))

Michał "phoe" Herda @phoe

@cwebber 80 chars is best when you want to have 2 or 3 files open at once.

@phoe I agree, which is why I tend to be very "conservative" about width

@cwebber @phoe It seems odd that we still worry about line widths when we're editing structured data like code. Why should the formatting even make it into the file?

@phoe @cwebber For something like Lisp I guess formatting helps convey the programmer's intent, but most programming languages have far more structured syntax, and their formatting rules are often far more rigid.

@freakazoid @cwebber That's why uglifiers exist for many programming languages, automatically parsing them and indenting them.

@phoe @cwebber I could get behind formatting on load and de-formatting on save.

@freakazoid @cwebber Sure, but now you need to invent a binary format for your source code that is *not* text. That's an obstacle.

@phoe @cwebber No more of an obstacle than inventing a concrete syntax.

@freakazoid @cwebber ...and get other people to use it in place of text. (:

@phoe @cwebber Yes I understand the chicken and egg problem at work. It's amazing how slowly programming has moved in the past 20 years.

@freakazoid @cwebber Because source code is still text almost everywhere*, including Lisp lands. Lisp programs are Lisp data, but Lisp source code is text due to the possibility of syntax modification at read-time.**

*Unless you are programming in Smalltalk.

** So you can make the Lisp reader understand C syntax, for example. github.com/y2q-actionman/with-

@phoe @cwebber I was really asking "why is source code still treated as text".

@freakazoid @phoe @cwebber jup.
I don't get why we even commit the formatting.

Just let everyone run their own go-like formatter.

Whatever the build server doesn't need does not belong into the repo

@saxnot @freakazoid @cwebber Indentation tends to convey meaning sometimes. Also, it's trivial to treat source as text and not as binary data. You can't trivially edit binary data with vim or emacs.

@phoe @freakazoid @cwebber no i was thinking more of a commit hook that removed all intendation and maybe newlines too.
The editor shall be responsible for displaying it how the user wants (whatever the editor is. This can be done trivially in vim and emacs - the hard part is deciding what format you want your code in)

@phoe @freakazoid @cwebber I don't know how it is with LISP. Here in Java-Land (where i am) Intendation is almost always computer-generated.

I shall remove all intendation. Press Ctrl+Shift+L and then it should be the same as previously.
Before every commit I make sure that my code is in line with the company formatting policy.

I don't care so much _what_ the policy is, as long as it's consistent umong all files

@saxnot @phoe @freakazoid indentation is entirely autogenerated... the question is, where do you put your *newlines*. And that affects indentation.

@saxnot @freakazoid @phoe lisp pretty-printers are and have been perfectly capable of printing decent code for 50+ years. But I guess I still like hand-tuning it.