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)])))
@cwebber Option C: endlessly dithering over whether to break 80 chars or put the first arg below the function name, both of which feel slightly wrong
@mostlycoolmark @cwebber Yeah tbh that is what I should be doing
@cwebber
Here in ruby a nice rule is, one line per idea. Doesn't always work out, but, nice to work towards. You can get lost even in plain text if it's too wide.
A while back I went from 80 chars to 100. Happy to keep to that.
@cwebber I do that for regexes I've pasted in from elsewhere and feel bad about it.
@kevinmarks well, string-based regexes are mostly hopeless (but pervasive) anyway, so
@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
@freakazoid @cwebber That's why uglifiers exist for many programming languages, automatically parsing them and indenting them.
@freakazoid @cwebber Sure, but now you need to invent a binary format for your source code that is *not* text. That's an obstacle.
@freakazoid @cwebber ...and get other people to use it in place of text. (:
@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. https://github.com/y2q-actionman/with-c-syntax
@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.
@cwebber @phoe @freakazoid oh, interesting.
@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.
@cwebber are you a lisper?
@cwebber oh, I see now. You hack Guile and/or Guix, right? I come from the land of Common Lisp.
@phoe Guile, Guix, and Racket... but also emacs lisp. I actually enjoy common lisp, but I don't have much reason to use it these days
@cwebber Yep, I see. I'm doing CL almost exclusively, touched the Schemes only a little bit, and never did Guile, Guix or Racket.
@ninjawedding @cwebber I don't even see what's wrong with that, but maybe the C has rotted my brain so hard I'm lost forever... ;p
@ninjawedding @cwebber eh, ok, then just fold 'em into the line above them :p
i kinda like this style, thinking about it, because it makes it really clear that these are actually lists of things.
@ninjawedding Yeah that's probably the worst thing to do, but it's understandable how someone might make a mistake like that if they've come from something C-like.
@cwebber to the extent this is a code smell and the code needs to be refactored, I prefer the version that makes that explicit, rather than obscuring it.
And yes I have code bases with long lines here and there sticking out from the 80 lines.
@cwebber I make sure all of my Lisp code passes PEP8. 👿
@cwebber Careful, those [] make you look like a racketeer!
@cwebber Scheme. Tabstop at 4, right margin's 100 or 128 chars, C-like close because I need to be able to read and edit code, and I don't care about religious dogma.
https://mdhughes.tech/category/scheme/
Haven't had time to publish much about the more serious project.
#scheme
@cwebber if I see lines go past 80 characters my nose bleeds.
I am, admittedly, the former even when I shouldn't be. But hey, it'll pay off if I ever get paid by the line of code.
Yesterday I saw someone's code though that passed 200 characters wide O_O