New private names proposal
Mark S. Miller
erights at google.com
Thu Dec 16 14:19:12 PST 2010
On Thu, Dec 16, 2010 at 1:58 PM, Kris Kowal <kris.kowal at cixar.com> wrote:
> On Thu, Dec 16, 2010 at 1:53 PM, David Herman <dherman at mozilla.com> wrote:
> >
> > function Point(x, y) {
> > private x, y;
> > this.x = x;
> > this.y = y;
> > ...
> > }
> >
> > than
> >
> > function Point(x, y) {
> > var _x = gensym(), _y = gensym();
> > this[_x] = x;
> > this[_y] = y;
> > }
>
> I tend to disagree with most developers, so take it with a grain of
> salt that I find the latter form, with all the implied abilities,
> easier to understand.
>
I do too. While terseness clearly contributes to understandability,
regularity and simplicity do too. When these conflict, we should be very
careful about sacrificing regularity.
Currently is JS, x['foo'] and x.foo are precisely identical in all contexts.
This regularity helps understandability. The terseness difference above is
not an adequate reason to sacrifice it.
>
> Kris Kowal
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
--
Cheers,
--MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20101216/4a89f58c/attachment.html>
More information about the es-discuss
mailing list