Programming Languages

Updated at 2022-11-12 04:56

This note is about programming languages in general. Contains mostly about terminology definitions.

Avoid disguising your code. If you write C++ using paradigms of FORTRAN, it is not C++. Program into the language, do not program with it.

Prefer high level languages. Start the project with high level languages, replace parts of the project with lower level languages only if you really need to.

Focus on learning ways of doing things. Learn the idioms, paradigms and popular frameworks of the language. Don't just use your old programming habits in a new context.

Programming languages are tools. Good and bad solutions can be built with any of them but they do have certain nuances.

to make it theoretically correct, use Haskell

to make it actually correct, use Rust

to make it fault tolerant, use Erlang

to make it versatile, use TypeScript

to make it simple, use Python

to make it portable, use Go

Basic Concepts


Computers store information e.g. in memory. Inserting an informational item into the computer store is assignment. This operation is overwriting.

x := 3

L-values, R-values

L-value represents an area inside the computer store. We can call this left-side or location. R-value is the area content.


Name means the L-value, which is a location or reference. Only thing important about names is that we need to have a way to say if two names are equal or not.


Stating that there is something with this name and this type.

real p;


Introduce new use of a specified name. Causes a new location not previously used to be set up as L-value of p and that the R-value 3.5 is assigned to that location.

real p; p := 3.5;

One name can have several different L-values (locations) in different parts of a program. This is the concept of scope a.k.a. lexicographical scope, which is usually controlled by block structure.


24 and XXIV are two different numerals representing the same number.


The result of adding x to y, not add x to y.

x := a(b+c)+d

The characteristic feature of an expression is that it has a value. To get expression value, we need values of sub-expressions. All following are thus equal.

sin(6) sin(1+5) sin(30/5)

We might need to know the context of an expression to compute the value.

// Here we need to know what a and b are.
a + 5 + b / a

Expressions can be written in applicative structure.

a + 3 / a
// which corresponds to
+(a, /(3, a))
// in functional syntax

Conditional expressions are possible.

(if x = 0 then 0 else 1/x)


Simple, names for things in the system. Assignment changes these.

// Get R-value of thing that has L-value of x. x := x + 1

Constant variables deny assignment after definition.


Abstraction applied to expressions. May not alter the computer store.


Abstraction applied to commands. May alter the computer store.

Fixed, Free

Fixed means that the result may not vary. Free means that the result may vary. (Functions, Routines)


Sort of object. Integer, Float, Label, Procedure

Is type property of L-value or R-value? Depends on language design. Statically type = type is property of L-value. Dynamically type = type is property of R-value.

Functions have types, types calling parameters and type of return.

Function that behaves differently depending on type is called polymorphic. Ad hoc polymorphism there is no single systematic way to define result type from the argument types. Parametric polymorphism is more regular and states that you can define result type from argument types.

Function with variable number of parameters is called variadic function.


R-value representing or being a location is called pointer. X is TYPE variable that has L-value Y. P has R-value Y. P is a TYPE pointer that points to X.

Object Oriented Programming

Objects protocols a.k.a. interfaces are important in OO design. Using object A's protocol, a client object B can use object A as a server.

Ease of reading > Ease of writing Complexity on Server > Complexity on Client

Other Good Features

Programs should be easier to read than to write.

Provide only one way to do things.

Static typing.


  • Fundamental Concepts in Programming Languages, Christopher Strachey (1967)