Subscribe to Blog via Email
December 2020 M T W T F S S « Mar 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Which programming paradigm is the most similar to human speech?
Well, let’s think this through.
I count three programming paradigms from when I was studying computer science 25 years ago: functional, logical, and procedural. They correspond to three types of semantics: denotational, axiomatic, and operational. The first two are pristine and beautiful articulations of mathematics and logic, respectively. The last involves modelling the internal state of a von Neumann machine, and is so ugly, it’s embarrassing to express it in mathematical notation at all.
By default, I would say denotational semantics comes closest to how formal linguists think of linguistic semantics. It uses statements about the world to formulate a model of the world. And that’s what humans do, in making assertive speech acts.
The catch is, the reason we interact with computers through programming languages is not assertive: we are not (yet) having a debate with the computer about moral philosophy or fiscal policy, for example. It is directive: we are trying to get the computer to do things for us.
The most straightforward way of directing an action is by issuing directive speech acts. We couch our commands to other people as questions and statements out of politeness, but we don’t really do that with a computer. And even when we are doing functional or logical programming, we are not truly authoring mathematical or logical proofs. We are using the mechanisms of those proofs, to get the computer to do something. What we choose to express in those paradigms is still driven by that goal.
(I did a semester project writing a parser in Prolog. My most important learning? Logic programming is still programming.)
So while functional programming is probably closest to how we think of natural language in general, procedural programming is closest to how we think of language in the context of human-computer interaction.