Dr. Schmood's Notebook of Python Calisthenics and Orthodontia
Don't get bit by misaligned state and output
The massive information processing power [...] will truly become available to the general public. And, I see that as having a tremendous democratizing potential, for most assuredly, information — data and the ability to organize and process it — is power.
~ Jim Warren Dr. Dobbs Journal Vol 1 (January 21, 1977)inline_formula not implemented
Sharing Information in 1977
The Hidden State problem is a problem with Python and not necessarily notebook interfaces.
A notorious example for a bad idea was the choice of the equal sign to denote assignment. It goes back to Fortran in 1957 and has blindly been copied by armies of language designers. Why is it a bad idea? Because it overthrows a century old tradition to let “=” denote a comparison for equality, a predicate which is either true or false. But Fortran made it to mean assignment, the enforcing of equality. In this case, the operands are on unequal footing: The left operand (a variable) is to be made equal to the right operand (an expression). x = y does not mean the same thing as y = x.
~ Niklaus Wirth, Good Ideas, Through the Looking Glass
--- Ada 95
procedure Main is
A, B : Integer := 0;
C : Integer := 100;
D : Integer;
if A = 0 and C = 100 then
A := A + 1;
D := A + B + C;
Reasoning About State
a=42 → Set a equal to 42 or a equals 42.
If either side of the equation changes, the other side must accordingly change.
a:=42 → a is assigned the value of 42.inline_formula not implemented
a becomes 42, but 42 does not become a. 42 is immutable, it will always be 42.
The thing on the right side will exist until nothing points to it, at which point it is garbage collected.
inline_formula not implementedNextjournal makes code runnable by applying these approaches to all levels of the stack. The notebook interface is a departure from IDEs of the past. Furthermore, it's not just the software you write that is immutable, it's the entire computation stack, down to the operating system. The data that drives the code is also content addressed and immutable. This makes running code in the cloud reliable, reproducing results effortless, and cloud collaboration possible.