The Boston Diaries

The ongoing saga of a programmer who doesn't live in Boston, nor does he even like Boston, but yet named his weblog/journal “The Boston Diaries.”

Go figure.

Monday, Debtember 01, 2008

Various shades of grey

Now, if you agree that there must be something fundamental, in lisps designs, that drives them all to social failure, what could be the root causes? I don't think the scare factor induced by parentheses is a real reason. Just look at the kind of scary, steaming piles of crapware Java developers are willing to learn: they're OK with filling a 2 meters long shelf with manuals explaining how to have ORM and hibernation. The more verbose and unreadable a design pattern is, the more they love it. XML is much much scarier than sexps, yet consulting services are hysterically excited by it. No, really, it would take much more than parentheses to scare a Java programmer.

So what could be the features of “normal” syntax that are missed by sexps? [link added —Editor] Most notably, normal syntax gives you a feeling of what's idiomatic vs. what's weird. This means the syntax encourages you to write in a certain way, and hopefully everyone will be encouraged to write in the same style, thus understanding each other's code better. This helps bringing you interoperability and favors the writing of reusable code.

With sexps, it's much harder to create, maintain and convey such opinions in the code's appearance. Everything tends to look casual, and if it doesn't, just add a macro to make it look OK. It's difficult to build a shared seense of Good and Evil under these conditions, and without this consensus you'll have a hard time building a functional social group!

Via metalua metalua 0.4

I think this brings up yet another aspect of Lisp I don't like—it all looks the same, regardless of what the code is doing.

For example:

(assert (>= 
          (cell-size (aref 
                      (aref (global-state-stack gs) (global-state-sundo gs)) 
                      y 
                      x))
          1))

(Not that I expect any self-respecting Lisp programmer would ever write such Lisp—I'm just making a point here.)

It's hard to see that it's rereferencing a structure field from a two dimentional array stored in an array of structures. The corresponding C code is a bit clearer on this (a real-life example taken from a program I wrote):

assert(gs.stack[gs.sundo][y][x].size >= 1);

It's clear that there are a few array and structure references (and a lot quicker to type, which seems to be an argument that those muddle-headed dynamic programmers love to make, not to say they like Lisp any more than I do).

Now sure, once you know what AREF does, you can see the array references, but what about that (global-state-stack gs) business? Well … yes, it's a function, but it just so happens to return the stack field from the global state structure named gs (but equally, it could have been returning the state-stack from the global structure named gs—but you won't know until you track down the proper DEFSTRUCT call).

Again, the C code makes it more visually explicit what's going on (well, in one aspect anyway—the meaning of the code is another thing entirely). Different things look different.

(Actually, now that I look at the C code, sundo is a bad name for that particular variable—it should really be sp (stack pointer) since that's what it's really used for; the sundo name derives from how I originally viewed the function of that variable, which was keeping track of states to undo. I should probably rename that variable to better reflect what it's actually used for, but I digress … )

Obligatory Picture

[It's the most wonderful time of the year!]

Obligatory Links

Obligatory Miscellaneous

You have my permission to link freely to any entry here. Go ahead, I won't bite. I promise.

The dates are the permanent links to that day's entries (or entry, if there is only one entry). The titles are the permanent links to that entry only. The format for the links are simple: Start with the base link for this site: http://boston.conman.org/, then add the date you are interested in, say 2000/08/01, so that would make the final URL:

http://boston.conman.org/2000/08/01

You can also specify the entire month by leaving off the day portion. You can even select an arbitrary portion of time.

You may also note subtle shading of the links and that's intentional: the “closer” the link is (relative to the page) the “brighter” it appears. It's an experiment in using color shading to denote the distance a link is from here. If you don't notice it, don't worry; it's not all that important.

It is assumed that every brand name, slogan, corporate name, symbol, design element, et cetera mentioned in these pages is a protected and/or trademarked entity, the sole property of its owner(s), and acknowledgement of this status is implied.

Copyright © 1999-2019 by Sean Conner. All Rights Reserved.