So much for my post about Java. I’ve been distracted by other things. Maybe I’ll get back to it when I’m feeling inspired by the subject again.
So: What’s on my mind now?
How about a discussion of the two primary factors of language design (as contrasted with implementation)? Let’s discuss what happens when I make a fairly straightforward, unarguably true (I thought) statement about the importance of syntax in language design.
It all started with a reddit discussion of Lisp vs. Python — or, more accurately, a discussion of a lengthy explanation of how the two compare titled Merits of Lisp vs. Python and composed by some aerospace engineer guy apparently named Tom. It’s worth a read, by the way — even if you disagree with some of it, there’s a lot of good information in there, presented in the form of Tom’s perspective after two glasses of wine.
Anyway . . . someone with the username sigfpe questioned the importance of prefix vs. infix notation in determining the elegance and simplicity of a language’s syntax. It seems sigfpe thinks that’s just a superficial detail, and wonders if (s)he missed something. My response went a little something like this:
> “Or is there some subtle and deep property of the placement of operators that I’m missing?“
Yes, there is. Prefix operators, employed consistently in a language, allows for a greater elegance and simplicity to the interconnected rules of syntax within that language. Precedence confusion, dirty hacks to chain operations, and grouping ambiguities are pretty much impossible with a consistent system of prefix, vs. infix, operators.
Realize that what the aerospace engineer who wrote that really meant, whether it consciously occurred to him or not, was not that prefix operators are more elegant than infix operators: it’s that prefix operators and everything they imply constitute a more elegant way to do things.
Ultimately, there are two important factors in determining the strength of a language design (as opposed to a language’s features, which is another subject entirely): syntax and semantics. “Semantics” refers basically to the superficial aspects of language design, like “Are we going to call our function constructor fun or defun?” “Syntax” refers to the form the language takes, the kind of thinking the (successful) programmer will do, and how programs fit together. That’s the deep magic of a given programming language, as manifest in its design. The choice of prefix or infix operators is a part of that.
The first response to me, from someone with the username andyc:
I think you got syntax and semantics mixed up
Needless to say, my mind boggled. Anyone out there reading this that understands subjects like syntax and semantics, particularly as they apply to programming language design, should be pretty clear on the fact that andyc said something pretty odd. I figured I should try to explain the situation, especially since for some reason andyc got an upvote from someone for that statement — indicating that andyc isn’t the only person at reddit who wondered whether I said something incorrectly. Time to settle the matter, complete with links to dictionary definitions in case the misunderstanding was due to unfamiliarity with the actual meanings of the terms being used:
Nope. Syntax relates to how “statements” (typically lines of code, blocks, et cetera) are composed. Semantics relates to what terms mean.
syntax = foo(bar) vs. bar.foo
semantics = foo(bar) vs. baz(bar)
That should settle it. Right? Right!? Well . . . apparently not. User pjdelport (yes, that makes three people so far that have actually pitched in their displays of ignorance) responded with this gem of “Am I too short? Did that go over my head?”:
In your original post, i think you got them the other way around, though.
Syntax is form, or “the superficial aspects of language design, like ‘Are we going to call our function constructor fun or defun?’“. Semantics is meaning, or “the deep magic of a given programming language, as manifest in its design“.
The choice of prefix, infix, or postfix syntax is ultimately a surface issue, as demonstrated by the various infix syntaxes for Scheme, and Haskell’s support for switching arbitrarily between prefix and infix application.
About the most flattering thing I can say about that is “At least pjdelport knows how to properly nest quotation marks.”
I responded to him, of course, though I didn’t say anything new and interesting — just double-checked with incredulity what he is assuming. You can read it there if you really want to.
Brian told me his take on what happened in that discussion:
in this case i think they’re idiots.
Sterling “chipped in” (sorry, the pun had to be made):
They just don’t get it.
This was Allison‘s reaction when she saw that thread of the discussion:
snerk What I want to know is where you get the patience necessary to hang out online and answer these people.
I literally laughed out loud at that one.
edit: I wonder if the confusion of someone like pjdelport can be blamed on the facile manner in which people have used the word “meaning” over the years to refer to the deeper questions of philosophy, as if saying “meaning” with some kind of ominous intonation or emphasis makes something more honest, insightful, and altogether important. Maybe the problem is the degeneration of university English departments in the post-Derrida era.