Abstract
Almost all programming languages allow array and object properties to
appear on the left side of an assignment, as in a[2] = 4 and a.x =
2. Curiously, none of the conventional programming languages permit
modifying a function’s behavior through assignments, such as in f(2) =
4. It seems the elements of a function’s domain have traditionally been
considered read-only, rather than true properties of the function. This
paper presents an exploratory experience in a compiler course, where
students, under the guidance of the instructor, were tasked with
implementing a programming language that extends assignment expressions
to allow the modification of a function on any element of its domain.
This proposal raises the level of abstraction for function modification,
compared to what is currently available in many modern languages. One
notable consequence of this extension is that by incorporating left-side
function assignment and realizing that all data structures can be
represented by function subclasses, we immediately get objects, arrays,
maps, classes, class inheritance, polymorphism, and access symmetry.
into a minimal language. Since all data structures are treated as
functions, it not only becomes natural to extend them with functional
default behaviors, but also to manipulate them using the algebra of
functions. At the same time, the language maintains access symmetry
among all data structures including functions, objects, maps and arrays,
removing the need for special access syntaxis and using everywhere a
functional notation.