Context Dependent Semantic: Python, Lisp setf
Many language have the syntax
a[i] = x to assign or replace a element in a list. It is a syntax that has context dependent semantics.
The issue here, is that it uses the same notation to indicate a “place”. For example,
a is the third index in array.
a=4 means make the third index to have value of 4.
The problem here, is that there's different meaning of
a in the 2 cases.
evaluates to a value.
does not evaluate. Rather, it's part of the syntax that tells the compiler of a “storage location”.
So, you see, the
print a and
a=4 have diff meaning, and is context dependent.
Common Lisp setf
The Common Lisp setf is the most screwed design in computer languages possible.
here's elisp manual explaining setf.
Forth and Bliss
And of course Forth also explicitly has fetch and store ops so you can say
3 a @ .and
x @ 3 a !for printing and assignment
The Bliss language (DEC Systems lang) had a unary dot operator to return a value so you'd say
—from Bahstin Beer Bum @mmaug, 2016-10-05