> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Jeff Dyer > Sent: 7. februar 2008 20:54 > To: Michael O'Brien; es4-discuss Discuss > Subject: Re: Scope rules > > > > > On 2/7/08 4:16 PM, Michael O'Brien wrote: > > > I'm trying to find the scope rules for constructor initializers and > > for function parameter default values. If someone could > point me to a > > document or clarify these that would be great. > > > > I've read bits and pieces. For constructor initializers: > > > > class Shape { > > function Shape(): > > leftSide = rightSide > > { > > } > > > > function render(arg1 = expression) { > > } > > } > > > > In the constructor initializers, I presume the leftSide has a scope > > equal to just outside the constructor and the rightSide binds to > > inside the constructor. Is this right? > > 'leftSide' targets the instance and so must be and instance variable. > 'rightSide' has a scope that includes the constructor > parameters, class statics and scopes beyond. > > > > > Also, can "this" be used in either right or left side? > > Since 'this' is implied on the left side and meaningless on > the right, I'd say not be both. > > > > > For function default arguments, is the scope of the expression just > > outside the function? > > This has been debated recently. I don't recall that there was > a resolution. > My thinking is is that default parameter expression should be > scoped to the scope just outside the function. This is how > the RI currently works, FWIW.
I agree. There's utility in left-to-right binding, but for the "let" block statement we went with parallel bindings and I think that makes sense for parameter lists as well. --lars > > Jd > > > > > Michael > > > > > > > > _______________________________________________ > > Es4-discuss mailing list > > [email protected] > > https://mail.mozilla.org/listinfo/es4-discuss > > _______________________________________________ > Es4-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es4-discuss > _______________________________________________ Es4-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es4-discuss
