On Mar 14, 2012, at 9:19 AM, Axel Rauschmayer wrote:
> Minification considerations aside (where compression should help), that point
> seems to be highly controversial: I, for one, much prefer `this` to any kind
> of shorthand. The brain works with tokens, so grawlix and words have similar
> cognitive load. Even for private names, I’d rather have regularity via
> this.@privateName than terseness.
>
> Obviously, mine is just one opinion among many, but not everyone wants `this`
> gone. The .{ operator or some variant of it should also help with verbosity.
I agree. Program readability should always be prioritized ahead of saving
keystrokes when writing code. Same goes for minimization. If a minimized
(over and above what we can get with compression) form of the language is
important then we should define a minimized non-human directed alternative
syntax rather than making the human readable expression of the language less
readable.
self invocation (eg, this.foo()) is probably the key idiom of object-oriented
programming. It is important that it stands out when reading code. Smalltalk
required an explicit "self" for self invocations. The self language tried to
innovate by not requiring an explicit self based upon the premise that self
invocation was so fundamental that only non-self invocations needed to be
syntactically explicit. However, personally I think that experiment was a
failure as I have always found self code much harder to read than Smalltalk
code.
Same goes for Java and C# where the this is optional. Using some sort of
marker symbol (such as @foo as an abbreviation of this.foo) helps the reader
distinguish self calls from regular function calls but it is debatable whether
that grawlix form is as readable than a simple this.foo.
Allen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss