Frameworks and linguistics

My friend George Figgs is a linguist and has the following to say about the mad libs metaphor for frameworks:

the madlib metaphor/concept also conjures up Chomsky’s arguments, where you can have a grammatically, i.e. syntactically, correct sentence that doesn’t make any sense semantically, as in the famous “colorless green ideas sleep furiously”, and from Lewis Carroll’s jabberrwocky - “twas brillig and the slithy toves did gyre and gimble in the wabe”.

these sentences are grammatical, as all of the necessary syntactic slots are filled with grammatically appropriate lexical items, but are ‘buggy’ in these sense that they’re filled with semantically infelicitous lexical items.

i don’t know much about frameworks, but this seems similar to unification based grammars, such as construction grammar, where, in order for sentences to ‘work’, they have to unify both lexically (‘type of food’), and semantically (“commonly eaten by humans”), to avoid the utterance being semantic gibberish.

This is interesting because there may be a way to use the formalisms already created in linguistics to explain or specify frameworks. It’s also good because it reminds me of a problem with frameworks in that they have deeper semantics than the OO language syntax expresses. For example, a framework superclass callback method “aMethod(int x)” could mean any of the following to the framework plugin:

  1. aMethod could indicate that the framework has transitioned from one lifecycle state to another.
  2. aMethod could indicate a spontaneous event, like a keypress, that your plugin may care about.
  3. the x parameter could be valid only during the callback, and storing it away could be an error
  4. the x parameter could be persistent data you need to keep, such as the new identity of your container

All of these possible interpretations inspired Kevin Bierhoff, Ciera Jaspan, and I to sketch out a paper on what a framework language would look like. If only we’d follow through on that. :-)