[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [NOISE] Curly braces [was Re: Curl]
> From: Tony Kimball <alk@pobox.com>
> Date: Fri, 30 Nov 2001 16:38:48 -0600
>
> Quoth Michael Vanier on Thursday, 29 November:
> :
> : Don't you mean:
> :
> : (> (/ (+ (- b) (sqrt (- (* b b) (* 4 a c)))) (* 2 a)) 0)
> :
> : ? I think that unmakes your point.
>
> I would rather say that it emphasizes another poster's point about
> IDEs: He was probably in a mail editor rather than a code editor, and
> it didn't do the paren blinking he's learned to rely upon.
And actually I caught the error in just that way, by pasting it into emacs
scheme mode.
>
> Having hacked reams of Fortran algebraic notation, I'll confidently
> state that one can't base a strong proselytic argument on the
> resistance of Fortran arithmetic expressions to errors of operator
> precedence.
Agreed. I should state that I don't consider infix to be any more
error-resistant per se, just somewhat easier for many people (including me)
to visually grok.
Someone suggested a "matheval" macro. Actually, tcl works like this; they
use something like
set d [expr b * b - 4 * a * c]
Personally, I find the contrast between the opening paren of the
s-expression and the parentheses of the infix expression to be troubling,
which is why I'd rather have curly braces to tell me "hold on! from here to
the close curly brace the regular rules no longer apply!"
> Algebraic expressions are not the only analogous case -- they are just
> the most familiar, because you've been taught to use them since you
> were wee. Indentation problems occur in Python, mismatched braces
> occur in C, etc. Lisp expressions and C blocks have the advantage
> that the reader/parser will catch the error in almost every practical
> case. Infix expressions relying on operator precedence lack this
> advantage. I haven't coded enough Python to make an inference
> regarding the likelihood of an uncaught indentation error.
>
When I program in python (which I do a lot) I occasionally make indentation
errors. Using emacs mode again catches most of them.
Mike