On 31 May 2012 10:44, Andreas Rossberg <[email protected]> wrote:

> On 30 May 2012 23:34, David Herman <[email protected]> wrote:
> > On May 30, 2012, at 2:27 PM, Rick Waldron wrote:
> >
> > On Wed, May 30, 2012 at 5:22 PM, David Herman <[email protected]>
> wrote:
> >>
> >>
> >>    array.{
> >>        pop();
> >>        pop();
> >>        pop();
> >>    };
> >>
> >>    path.{
> >>        moveTo(10, 10);
> >>        stroke("red");
> >>        fill("blue");
> >>        ellipse(50, 50);
> >>    };
> >>
> >>    this.{
> >>        foo = 17;
> >>        bar = "hello";
> >>        baz = true;
> >>    };
> >
> >
> > This is beautiful and looks powerful -- will it still meet the most
> > common/obvious use case?
> >
> > var div = document.createElement().
> >
> > div.{
> >   style.{
> >     color = "red";
> >     left = "100px";
> >   }
> > };
> >
> >
> > I didn't specify in my blog post. :) I'm open to it. I tend to find the
> > nested syntax a little brain-exploding, but I understand the motivation.
>
> Assuming you propose to allow things like o.{a.b = 6; c.f()} anyway,
> then the above would actually fall out for free if you defined your
> syntax as pure syntactic sugar, and do the rewriting in the natural
> bottom up manner.
>
> /Andreas


I'm worried this looks a lot like `with` -- with the same issues. Is the
idea that unqualified references would be _required_ to be properties of
the object in question? So

o.{
    a.b = 6;
    c.f();
};

...would work, but

o.{
    a.b = foo;
    c.f();
};

...would throw (assuming there is no `foo` property)?

I keep meaning to propose a new `with` (different keyword, obviously) that
solves the `with` issues by using a leading dot -- but I wanted to lurk a
while beforehand, can't imagine it's an original thought (esp. as I used
_some_ language in the 90s that did that).

-- T.J.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to