4 ms·
I'm baffled. You just described pretty much any programming language to me.
by kalaksi 2y ago
I'm baffled. You just described pretty much any programming language to me.
- netbioserror 2y agoI have personally seen production code consisting of C and PHP programs with GLOBAL shared state bounced back and forth between dozens of functions simultaneously, where the parameters reflect only a fraction of the actual input data to the functions' procedures. Expressions and airtight design may seem normal to you, but older generations of programmers either had little exposure to philosophical musings on the constitution of good software design, or received roundly awful early wisdom from the industry's nascence. Of course, C has a habit of enforcing essentially no rules on program design, so it was a wild world of scattershot practices (or anti-practices).
- greener_grass 2y agoIn most languages, the value of an expression depends on two things: 1. The right-hand-side of the declaration 2. Where you are in program execution Consider this JavaScript: let x = 1; x += 1; x *= 3; What is the value of x? Valid answers are 1, 2 and 6. Now lets restrict our JavaScript to pure expressions: let x1 = 1; let x2 = x1 + 1; let x3 = x2 * 3; The values of x1, x2, x3 are full defined by the RHS; they do not change once bound. This makes it easier to reason about the code - you only need to follow the definitions. This is an unnatural way to write JavaScript, but some languages make this easy (Clojure, Elm, OCaml, F#, Haskell, Erlang, ...).