STYLE: Explain how to indent lambda-lists.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 27 Jul 2019 11:23:47 +0000 (12:23 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 27 Jul 2019 13:56:31 +0000 (14:56 +0100)
STYLE

diff --git a/STYLE b/STYLE
index c1eb705..b07bd98 100644 (file)
--- a/STYLE
+++ b/STYLE
@@ -64,6 +64,29 @@ collected by SLIME.  Some exceptions:
     fixing.  Since I don't use hairy ~loop~ much, this isn't a major
     problem.
 
+  + Emacs indents lambda lists really badly.  I often prefer to put the
+    entire lambda list on its own line than to split it.  If I have to
+    split a simple lambda list, without lambda-list keywords, I just
+    align the start of each subsequent line with the start of the first
+    argument.  I break hairy lambda lists before lambda-list keywords,
+    and the start of a subsequent line aligns with the first argument
+    name following the lambda-list keyword which begins the group, so
+    that the lambda-list keyword stands out.
+
+    : (defun many-arguments (first second third
+    :                       fourth fifth)
+    :   ...)
+
+    : (defun hairy-arguments (first second third
+    :                        &optional fourth fifth
+    :                                  sixth
+    :                        &rest others)
+    :   ...)
+
+    I don't know what I'd do if I had a hairy lambda list with so many
+    mandatory positional arguments that I had to split them.  So far,
+    this situation hasn't come up.
+
 Lines are 77 characters at most, except for strange special effects.
 Don't ask.  This is not negotiable, though.  Don't try to tell me that
 your monitor is very wide so you can read longer lines.  My monitor is
@@ -257,13 +280,13 @@ I've also tended to go for fairly prosaic names, taking my inspiration
 from the CLOS MOP.  While I mourn the loss of whimsical names like
 ~haulong~ and ~haipart~, I've tried to avoid inventing more of them.
 
-There's a convention, which I think comes from ML, of using ~_~ in a
-where a binding occurrence of a variable name is expected, to signify
-that that the corresponding value is to be discarded.  Common Lisp,
-alas, doesn't have such a convention.  Instead, there's a sequence of
-silly names used with the same intention, and the bindings are then
-explicitly ignored with a declaration.  The names begin ~hunoz~,
-~hukairz~, and (I think) ~huaskt~.
+There's a convention, which I think comes from ML, of using ~_~ where a
+binding occurrence of a variable name is expected, to signify that that
+the corresponding value is to be discarded.  Common Lisp, alas, doesn't
+have such a convention.  Instead, there's a sequence of silly names used
+with the same intention, and the bindings are then explicitly ignored
+with a declaration.  The names begin ~hunoz~, ~hukairz~, and (I think)
+~huaskt~.
 
 
 * Declarations
@@ -276,7 +299,7 @@ actual correctness, declarations provided by the caller need to be split
 up into a number of different parts of the expansion, which in turn
 requires figuring out what the declarations mean and which bindings
 they're referring to.  That's not completely impossible, assuming that
-there aren't implementation-specific declarations which crazy syntax
+there aren't implementation-specific declarations with crazy syntax
 mixed in there, but it's more work than seems worthwhile.