C++ style question/criticism, was Re: Mozy Contest Answers

Levi Pearson levi at cold.org
Mon Nov 6 09:29:08 MST 2006

On Nov 5, 2006, at 9:49 PM, Hans Fugal wrote:
>> My vim-fu has become weak since I started programming in Lisp with
>> emacs, so I only recall what % does off the top of my head.  There's
>> that memory thing again.
> That's one you don't want to forget especially as a LISP coder. In the
> (perhaps rare) case that you find yourself editing LISP in vim you'll
> want it. Or, you'll want vim7 that highlights the matching
> paren/brace/bracket under the cursor.

Right, I said that's the one I DO remember, and I used it frequently  
during the short period that I programmed Scheme in vim.   
Fortunately, I didn't have to wait for vim7 to get paren-highlighting  
in emacs, and I can navigate by s-expression instead of by character  
or line.  Maybe you could make vim do that too, but it wasn't worth  
my time when emacs already had all sorts of handy Lisp programming  
support built in.  Which makes sense, considering most of emacs is  
written in elisp.

>> Even with fancy editor navigation, you simply get more context when
>> things are reasonably compact.  Jumping around in the code via editor
>> magic is just as distracting as scrolling is.  It's like a context
>> switch for the visual cortex.  The more clear meaning that can fit
>> within visual range on a screen, the more meaning can be absorbed in
>> context before movement must take place.
> For my $0.02 I prefer the { on its own line, and no braces when
> unneeded. I used to prefer "java style". I don't know why my  
> preference
> changed, but it probably has to do with the prevailing style of code I
> read written by people smarter than me.

Of course, when dealing with code written by other people, one has to  
adopt the coding conventions of that body of code.  That doesn't mean  
the conventions are any good, or that the smart people were actually  
bringing their smarts to bear on conventions instead of just  
following one someone else came up with.

>> You can see how the close-parentheses just build up on the end of the
>> last line of Lisp.  You may think this is ugly at first, but it is
>> done because the parentheses are just punctuation, and Lispers just
>> don't look at them.  Giving them each their own line would be
>> ridiculous, since the function would take a huge amount of space to
>> say exactly the same thing, and would be less clear to boot since the
>> information would be spread further from the center of the visual  
>> space.
> And this is the primary problem with LISP, but it is mitigatable  
> with a
> helpful editor.

Perhaps it was a problem with LISP, but it is not a problem with  
Lisp, since helpful editors for it have existed since we came up with  
lowercase letters on our computers. ;)


More information about the PLUG mailing list