I thought of a programming language where every function
can only return one type: the return type. The return
type is just a wrapper around a struct that contains the
actual return value, but also a reference to the called
function and arguments, and possibly an error code.
My flashback —
Way back in the last millennium I started work on a programming style
I called an “idea processor”, where an “idea” is a pointer to a “form”
and a form is a minimal type of record containing 1 character, 1 number,
and 4 more ideas.
I implemented a functional style where all the main functions are transformations
of one or more ideas to a return idea. The principal data type is an “idea-form flag”
which serves a role analogous to a “cons cell” in Lisp.