9

Bjarne Stroustrup writes in his The Design and Evolution of C++ book (item 3.5.1): At this point, the object model becomes real in the sense that an object is more than the simple aggregation of the data members of a class. An object of a C++ class with a virtual function is a fundamentally different beast from a simple C struct. Then why did I not ...


7

Today, most people who learn a programming language know very little mathematical notation and are more familiar with other programming languages, and with symbols that are available on their computer keyboard. Of course, this wasn't the case in the 1950s and 1960s when some of the major programming language families that exist today appeared. A lot of ...


2

I believe you are looking for Morris style Contextual Equivalence. Which says that the meaning of a term (in your case a subroutine) should not change in any context. If, $⟦ \cdot ⟧ : term \to \mathcal{D}$, is the meaning function then $$\forall C. ⟦C[t]⟧ = ⟦ C ⟧ \circ ⟦ t ⟧ $$ Where $C[\cdot]$ is a context with a hole in it.


2

This isn't as exotic as it sounds, and you can do it in a procedural language fairly easily. The basic idea is just that instead of changing a value you just have a function return a new value. For instance, instead of something like string read() { string s = ''; while((string c = getchar()) != '\n') { s += c; } return s; } you could ...


2

It is not required that the language is lazy. The do notation exists in SML family of languages (for instance OCaml), which are eager. In these languages the do-notation is written as the let-notation, that is, instead of writing do x1 <- e1 x2 <- e2 ... return e we write let x1 = e1 in let x2 = e2 in ... e Note however that let in OCaml ...


1

Sure, why not? F# is eager (not lazy) and has a sort-of do-notation. Imperative PLs might add that as well, even if there's less need for monads there, since side effects (including mutating the values of variables) is a key aspect of those languages. Scala has a for loop which resembles a monadic comprehension, so it's quite close to a do-block.


Only top voted, non community-wiki answers of a minimum length are eligible