loading page

Function Expressions on the Left Side of Assignments
  • Casiano Rodriguez-Leon,
  • Coromoto Leon,
  • Jose Rodriguez-Rosa
Casiano Rodriguez-Leon
Universidad de La Laguna - Campus Anchieta

Corresponding Author:[email protected]

Author Profile
Coromoto Leon
Universidad de La Laguna - Campus Anchieta
Author Profile
Jose Rodriguez-Rosa
Universidad de La Laguna - Campus Anchieta
Author Profile

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.
22 Oct 2024Submitted to Software: Practice and Experience
23 Oct 2024Submission Checks Completed
23 Oct 2024Assigned to Editor
24 Oct 2024Review(s) Completed, Editorial Evaluation Pending
25 Oct 2024Reviewer(s) Assigned