[dbohdan] 2014-07-24: I haven't found discussions on the matter on the wiki, so I made this page. What do you guys think of the following style of indentation for functional-leaning Tcl code? ====== # 1 return [ join [ ltrim [ struct::list mapfor x $msgLines {string range $x $indent end} ] ] "\n" ] ====== Its main benefit over [Lisp%|%"Lispish"] indentation like ====== # 2 return \ [join \ [ltrim \ [struct::list mapfor x $msgLines {string range $x $indent end}]] "\n"] ====== or ====== # 3 return [join \ [ltrim \ [struct::list mapfor x $msgLines {string range $x $indent end}]] "\n"] ====== is that it doesn't break when a backslash at the end of a line goes missing. The respective downside is that when you can't tell whether a command at the beginning of the line is being quoted or substituted from just looking at it; you have to see whether the line above it ends with a `[` or a `{`. On a related note, have you programmed your text editor to manage the backslashes within square brackets for the second/third style of indentation? I'm considering doing that but it still seems brittle: insert one newline in another editor (e.g., vi on the command line) and it breaks. An rather more ugly example: ====== set conn [ ::ftp::Open [ dict get $websiteConfig deployFtpServer ] [ dict get $websiteConfig deployFtpUser ] [ dict get $websiteConfig deployFtpPassword ] -port [ dict-default-get 21 $websiteConfig deployFtpPort ] -mode passive ] ====== vs. ====== set conn [::ftp::Open \ [dict get $websiteConfig deployFtpServer] \ [dict get $websiteConfig deployFtpUser] \ [dict get $websiteConfig deployFtpPassword] \ -port [dict-default-get 21 $websiteConfig deployFtpPort] \ -mode passive ] ====== <> Discussion | Code Style