Having unbalanced parentheses is particularly nasty syntax error in most programming languages. Why so nasty? Because they can confuse the parser greatly, leading to a cascade of misleading errors. Furthermore, some languages such as Lisp and Scheme require parenthesisation around every expression, leading to deeply nested parentheses that one cannot easily match visually.

Fortunately, with any decent editor, unbalanced (or mismatched) parentheses are easily avoided. vi, for example, has the % command; if you press % while the cursor is over a parenthesis (or any bracketing character), the cursor will be moved to the matching one.

Emacs has the variable blink-matching-paren: if enabled (non-nil), when you type a bracketing character, it momentarily moves point over the matching one. XEmacs does even better, with the variable paren-mode: it can be set to one of the symbols:

The documentation for paren-mode also describes a future enhancement that will make dedicated Lispers jump for joy. Though not implemented yet, setting paren-mode to nested will eventually ``use variable shading to see the nesting of an expression''. How neat is that?

Log in or register to write something here or to contact authors.