With guillemets, « and », you can make a section of Shrubbery code indentation-insensitive. The idea for copy-paste it to "armor" the section you want to copy with guillemets in the right places, and unarmoring it after posting.
This needs editor support to do fluidly, but imo it's much better than trying to copy-paste the indentation-sensitive syntax.
The Guillemets syntax is described here: <https://docs.racket-lang.org/shrubbery/group-and-block.html#...>
I can't tell from my 5 minutes of poking DrRacket whether it supports this "armoring", I've been writing Shrubbery in nvim, which, unsurprisingly, does not support it.
(Moving blocks of code around is not a real problem if your editor is capable of easily highlighting the thing that was just pasted. Because then you just hit that key binding, then press `>` or `<` — or Tab/Shift+Tab if you are using an inferior editor ;-) — until the indentation is where you need it. I haven't found it to be a big problem in practice when writing Python, though mileage will likely vary).
But that's cumbersome compared to moving the block of code and hitting Tab to have your superior editor immediately indent the block at the right level.
I do not know why I have never seen this solution in practice.
functionName
arg1
arg2
arg3
(function
| Choice1of2 x -> 1
| Choice2of2 y -> 2)
Note how the | needs one extra space in order to line up with the word "function", due to the open parenthesis. If you're using tabs for indentation, that means you need a series of tabs plus one trailing space after the tabs, in order to line up the | correctly.Any situation where you must have a mixture of tabs and spaces for code to work right leads to a nightmare. Because it makes you have to turn on visible whitespace in your editor and peer closely at the lines. I have a simple rule: "Do NOT make me care whether there are tabs or spaces in this file!" If it's significant whether a line is indented with a tab or space, then that rule is broken, and you're probably in for a bad time. (Case in point: Makefile syntax).
( ...
| ...
| ...
| ...
)
or { ...
; ...
; ...
; ...
}IMO the biggest downside is that it gets awkward to do closures and inline expressions and things like that. For example Python's `lambda` and if-else expression which are super weird and special snowflakey compared to the equivalents in e.g. Rust or OCaml or even Tcl.
Maybe there's a way to do it nicely; I haven't thought about it too much.
> mismatched tabs/spaces being used for indentation between team members
It's really not an issue at all in practice. The issue of making moving code more awkward is true but really barely an inconvenience. It's not difficult to select it and press tab a couple of times.
As I said the biggest issue is with closures and expressions that you might want on one line.
Tell that to the one team at my old workplace that used spaces for all their scripts.
Like I said it’s a stupid source of errors that can be mitigated through style guides and tooling but it’s still a source of errors.