[E-Lang] get, set, and dot

Dean Tribble tribble@e-dean.com
Sat, 24 Feb 2001 14:59:17 -0800


I also recommend against the "struct" notation (in spite of having some 
small affection for it), for several reasons:

For illustration, I will use

a.foo := x

which considered syntactically equivalent to

a.setFoo(x)

* It introduces two *common* syntaxes for doing a *common*
   thing.  This is *much* worse than syntactic sugar for
   a common pattern.
* Straightforward tools to search for uses of methods won't
   find it, it interferes with grep.
* Though it appears to be assignment, there's no particular
   assurance that setFoo does assignment.
* the language is case sensitive, and yet 'foo' is different
   from 'Foo'
* it interferes with naming conventions that distinguish
   instance state (long-lived and instance based) from
   other state (temporary invocation) because it so
   strongly suggested that the variable and accessor should
   use the same name (e.g., only foo/setFoo(x), not
   myFoo/setFoo(x) m_foo/setFoo(x), m_foo/foo(x)).
* this style support *encourages* passive struct approaches
   to data structures and problem solving rather than more
   active ones.

I realize that some of these objects could be applied to many of the 
syntactic sugars, but in most other cases, the sugared form is the familiar 
and by far common expression.  It is not familiar to have what looks like 
public access to instance state coexist with method invocations (whereas 
a[3] := x is familiar, and comfortably applies to collection objects 
because they have exposed representation).  In the languages from which E 
derives syntax, '[]' is familiar and this use of '.' is not.