|
If you treat assignment as a function, then you have to reify environments as run-time objects, whereby you basically lose lexical scope. Lisp originally, as in LISP, had assignment as a function: it was called SET. To use it, you usually had to quote: (SET 'VAR 42). It worked without an environment parameter because variables were in a pervasive environment, but the quote was needed to get the variable symbol as a run-time value. (SET VAR 42)
would mean evaluate VAR to a symbol, and then pass that symbol to the SET function along with 42, so whatever variable was in VAR would be assigned. Assignment is inherently non-functional, since it is a side-effect, so it is mostly counterproductive to model it as a function. A pattern matching or logical language can have implicit bindings as the results of an operation, and so produce variables that way. Then instead of assignment you have shadowing, in that some construct binds a variable again that was already used, so that the most recent value then emerges, shadowing the previous one. |