Chad Perrin: SOB

15 February 2007

syntax vs. semantics: the other way around

Filed under: Cognition,Geek,Metalog — apotheon @ 06:38

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.


  1. I’m glad we’re back to discussing the original question. My apology is here of course:

    I’m a ‘he’, btw :) Kartik is kinda like John in south india.

    Measuring impact from the perspective of the programmer’s routine is a valid point. Funnily enough, that’s kinda what I had in mind in my comment about naming. I need to formulate it properly first, though. Look for further comment on reddit.

    Comment by Kartik Agaram — 15 February 2007 @ 03:41

  2. Welcome to SOB. I’m glad we’re seeing a little more clearly about each others’ perspectives — it makes for much more interesting discourse.

    I’m looking forward to your commentary about naming, now that I know you’re planning to elaborate.

    Thanks for helping turn a burgeoning flamewar into an actually productive discussion about the nature and effects of programming design characteristics.

    Comment by apotheon — 15 February 2007 @ 04:15

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

All original content Copyright Chad Perrin: Distributed under the terms of the Open Works License