I recently (measured in hours) commented on a disagreement over syntax and semantics. I’ve come to a realization:
The people who disagreed with me may not have been completely out in left field in their disagreement with my characterization of each. That’s not to say I was wrong — just that they were possibly looking at it from an alternate viewpoint. Unfortunately, that’s not all there is to it, so we can’t all just go home happy that we’ve agreed to disagree about the angle of our view on the matter.
I referred to semantics as the more “superficial” of the two aspects of language design, because its effect on the way we program is more superficial. By contrast, then, syntax has a “deeper” effect on how we program than semantics. That’s my perspective.
I don’t know if this is their perspective or not, but it occurs to me that it’s a possibility:
Syntax refers to the most visible aspects of language design — in what order you arrange things, what elements are necessary to compose a complete (and correct) statement, and so on. Semantics, meanwhile, refers to the meaning of things — such as whether your return statement returns the value of something or a reference to it.
Both, of course, can have a significant effect on how we program when using a given language. It really may even be arguable which has the greater effect, and (despite its rancorous phrasing) reddit user akkartik‘s comments in a new reddit discussion begin to make some interesting points to the effect that semantics have a more significant effect on how we think about programming than syntax, even though I think he’s achieving some of that via (perhaps accidental) exaggeration. There’s a potential nugget of wisdom buried there, however, and it’s worth considering, even if
the guy strikes me as a first impression as a bit of a wanker. update: It’s becoming pretty clear he’s not actually a “wanker”. Don’t judge a book by its cover.
Ultimately, the implication that most interests me is that there are aspects of programming language design that could, from a perspective other than the one with which I started, be assigned to semantics rather than syntax — though I would have assigned them to syntax. After some thought, I think some of these characteristics actually fall into a gray area between the two, where syntax and semantics overlap. These, in fact, may be among the most influential characteristics of a language’s design in determining how the language really shapes effective programming practice using that language. For instance, the Lisp notion that everything is a list is made feasible, even in theory, only by considering specific syntactic and semantic considerations that necessarily blend a bit in the middle. Considering that “everything is a list” is kinda the central defining characteristic of Lisp (popular gushing about macros, and incredible power granted by code == data, aside), that makes a pretty good case to me for the integration of syntax and semantics at the point where the interesting stuff happens.
I’m still not entirely convinced, but it’ll take some thought or, if someone actually manages to pull it together enough to offer one, a cogent argument.
That’s where the new problem arises: Even if the other participants in the earlier discussion were simply looking at things from a different perspective, they were absolutely incapable of expressing a salient point. The (nominal) counterpoints to my statements were nothing but unsupported, mindless naysaying. In the new discussion, pjdelport even ends up falling back on an argument from authority fallacy to show how stupid I must be. (S)he even assigns pejorative meaning to my use of the term “ignorance” in the process, where it wasn’t really intended — after all, everybody’s ignorant about a great many things, even me. (It’s the term “displays” that carried pejorative meaning in that sentence.)
Of course, akkartik made the same mistake when (s)he said:
apotheon’s wrong regardless [. . .] in mistaking humility and politeness for ignorance.