One thing I just have not been able to understand is why nobody prefers to put your ending bracket on the next line. For example, I think most devs would prefer this


over this


I think the second example

1. Helps you see where your ending brackets correspond to
2. Prevents long lines

Show thread

Anyone have any personal opinions on this or have an explanation why the first option might be preferred?

@kyle I personally completely agree... but I see the second a lot more than the first. I've only seen the first with Python programmers, which may be a reflection of the generally indentation-based syntax of the language (as opposed to using explicit block scoping). I'm working on a Rust codebase right this moment, for example, and rustfmt takes the second option in many cases but never the first.

@syntacticsugarglider that's interesting, maybe I only feel this way because I stay in my corner of just python, JS and a bit of list

@kyle I generally use the second style, though I'd indent the list of arguments. Depending on complexity each function call in that kind of nesting could get a level of indentation.

@kyle I do parens on the next line, with function calls or even ifs and fors. It makes it easier to edit too. That said I've seen some hardcore lispers use a mysterious secret typing technique called paredit that allows them to ignore parens entirely. They work in terms of indentations/whitespace (kind of like python), parens are handled automatically when writing, and when reading you ignore them, cause they are none of your concern as long as you use paredit.

@namark I never realized that trick, I'll have to check that out

I've always seen the first example most prominently in the lisp the community, it's one of the reasons I haven't seriously used lisp

Sign in to participate in the conversation

Merveilles is a community project aimed at the establishment of new ways of speaking, seeing and organizing information — A culture that seeks augmentation through the arts of engineering and design. A warm welcome to any like-minded people who feel these ideals resonate with them.