Programing Languages and Their Computational Models
As years go by, i get more insights about programing languages. For computation to happen, you need: ① A machine. ② Instruction set. (this is the programing language) ③ recipe, using the lang (this is the algorithm, or actual source code.)
Because lang needs a machine, and machine can be very different. Example • CPU/Chipset • Abacus (japanese, chinese, number of columns, or 2 piles of stones on sand) [see Abacus] • Cellular automata [see Notes on A New Kind of Science] • Molecules (dna comp) • Traditional axiomatic math. The lang can be quite different.
On the surface, different langs are similar. e.g. perl python ruby. All have function, variable, list, hashtable. But often they are really quite different. Because, they are for different machines. A high level abstract ideal machine, we say “computational model”.
For example, both perl and python have object as in OOP. However, “object” is a core concept of python, but does not exist in perl. Rather, perl has concept of reference, from which, programer notion of OOP object is based on.
In lisp, object of OOP sense does not exist in the lisp language model. The lang does have concept of object, but it means roughly compiled code. The programer sense of OOP object, is done as so-called multi-dispatch system or “common lisp object system”.
[see Meaning of Object in Computer Languages]
[see Polymorphism, Dispatch, and the Tale of Poly-Tinting]
In lisp and Wolfram Language, these lang have a concept of symbols, often said to be symbolic languages. It is a core element of the lang. It means, the whole lang, is based on processing sequence of symbols (for non-lispers, it roughly mean manipulating tokens identifiers keywords.)
It's most easy to see language's model (i.e. The machine it is designed for), by looking at assembly languages. Here, we don't even speak of “computational model” anymore. Because, their model is directly a machine, a specific cpu chip.
Ok. The point of this thread so far, is that: ① the 3 things computation needs. ② specifically, each language has a associated machine it's designed for. ③ the machine of a high level langs, are often called its “computational model”
Most programing language don't have any explicit notion nor exact spec of their computational model, because, most just grew out of practice. Example: Perl came from shell script. Php came from perl scripts. Ruby's conceived as improving perl. Almost no high level lang began with a model.
now let's look at some lang specs.
- perl http://perldoc.perl.org/index-language.html
- python https://docs.python.org/3/reference/index.html
- scheme https://schemers.org/Documents/Standards/R5RS/HTML/
- racketlang https://docs.racket-lang.org/reference/index.html
- golang https://golang.org/ref/spec
- and here's java lang spec https://docs.oracle.com/javase/specs/jls/se10/html/index.html
Note that they are bewilderingly different in what they seems to cover. You'd think they all high level languages in about the same field so that their spec should have the same structure/topics that only differ in detail.