Any editor written or actively maintained in the current century does this automatically for you. (Yes that obviously includes Emacs and Vim).
Underappreciated benefit of side benefit of indentation based languages: no copy-pasta.
I think rixed means "code editing" (I guess that rixed is simply not a native (L1) or excellent L2 English speaker).
That said, it is hard-mode:
- You'll have to figure out how to parse it.
- If you want editor support, it's a pain to get tree-sitter to handle it.
- You may not be able to pull off editor operations like "rename" without implementing a pretty printer (a rename might affect indentation).
I think it is helpful for crude error recovery. On parse error, my language will simply skip to the next column 0 token and parse another declaration.
I did not do this (hindsight), but I would recommend arranging the grammar so you only get indented blocks in cases where the previous line ends in a keyword that introduces it. I think python has a trailing `:` every time indentation is introduced, and Elm does this too - in statements like `let` you need a newline after the `let` to get the multi-declaration version. (This addresses the rename issue.)
I think I need to see an example.
foo x y = do a <- something
pure somethingElse
Renaming `x` to `xxx` would push the indented block in and the subsequent lines would have to be indented too.Similarly:
foo x y = let a = something
b = anotherThing
in somethingElse
Elm avoids this by requiring an newline after the `do` and `let` (if the `let` has multiple assignments).Edit: This was brought to my attention by an Idris style guide that said: "Indent so that alpha conversion always works with a simple search and replace. In general this would mean starting a new line when starting a new level of indentation."
I find it easy to see if things are on the same indentation. I find it much harder to visually scan for opening and closing braces unless syntax highliting makes them scream at me or they are accompanied by ...indentation.
Perhaps English is not a native language for zlsa?
And I love that people love indentation based languages so I show them a file with some spurious tabs to see how they feel about indentation causing silent errors.