Date: Tue, 12 Aug 2008 09:25:27 +0200

   . . .

   What's so different in $foo-bar versus $foo*bar, $foo+bar or
   $foo/bar? The latter might e.g. indicate path variables.

FWIW, one sees "hyphen substitution" like this only very rarely in
Common Lisp code, despite the fact that programmers have unbelievable
freedom to use arbitrary characters in identifiers, even parens (with
quoting).  There are a few visual conventions that use characters you
won't see in Java, such as "*foo*" for a global, "+foo+" for a global
constant, "%foo" or ".foo." for something internal, etc.  But if the
name is long enough to require several words, people almost invariably
use "-" internally, because out of all this variety (surprise) it's
still easiest to type.

   So IMHO it would be a shame to support the extra complexity in order
to provide a freedom that is used so rarely that it mostly just trips
people up.  (That's an argument against "$foo*bar" et. al., but I admit
it tends to support "$foo-bar".  Unless we all switch to Emacs.  ;-)

   Or imagine a coding convention where junctive variables bear their
   generating operator: $foo|bar, $foo&bar and $foo^bar.

That gives these variables names that add no information, which sounds
like a bad idea.  I have sometimes seen similar code, e.g.

        (defun solve-quadratic (a b c)
          (let ((sqrt[b^2-4*a*c] (sqrt (- (* b b) (* 4 a c))))
                (2*a (* 2 a)))
            (values (/ (+ (- b) sqrt[b^2-4*a*c]) 2*a)
                    (/ (- (- b) sqrt[b^2-4*a*c]) 2*a))))

Every token that is not "(" or ")" or whitespace is a valid CL
identifier.  But in this case, "sqrt[b^2-4*a*c]" is better called
"sqrt-discriminant" anyway.

                                        -- Bob

Reply via email to