Re: Using reserved words as member variable/method names

2015-09-30 Thread Josh Tynjala
I just gave the latest nightly a try, and I successfully compiled some classes that had reserved words as method names. Thanks, Alex! - Josh On Thu, Sep 24, 2015 at 12:10 PM, Josh Tynjala wrote: > I think with FlexJS still in an evolving state, this doesn't seem like a > huge risk. We're not pu

Re: Using reserved words as member variable/method names

2015-09-24 Thread Josh Tynjala
I think with FlexJS still in an evolving state, this doesn't seem like a huge risk. We're not pushing these changes into the older compiler, which has a larger audience with more legacy code. Regardless, since the reserved words were not allowed by the compiler in the past, it seems like there is a

Re: Using reserved words as member variable/method names

2015-09-24 Thread Alex Harui
OK, well that made things “easier”. I’ve pushed changes with a few tests into the JsToAs branch. Volunteers are welcome to add more tests for the other keywords Now the question is: Do we gamble and merge these changes into the develop branch for the upcoming release? -Alex On 9/24/15, 9:15 A

Re: Using reserved words as member variable/method names

2015-09-24 Thread Josh Tynjala
Requiring "this." before a reserved word when it's used as the name of a member seems perfectly reasonable. It's sort of the same thing as when a function parameter is named the same as a member variable. function(param:String):void { this.param = param; } Sometimes, certain naming conflicts

Re: Using reserved words as member variable/method names

2015-09-24 Thread Alex Harui
Well, this is turning out to be trickier than I thought. I’m not a language person, but one difficulty in getting this to work in our compiler seems to have to do with a key difference between AS and JS. As Josh mentioned in the links below, in JS identifierNames can be used essentially anywhere

Re: Using reserved words as member variable/method names

2015-09-22 Thread Alex Harui
I’m going to see what compiler changes are needed for this. -Alex On 9/18/15, 4:56 PM, "Josh Tynjala" wrote: >Here's the section on reserved words in the ES5.1 spec: > >http://www.ecma-international.org/ecma-262/5.1/#sec-7.6.1 > >And the same section in the ES6 / ES2015 spec: > >http://www.ecma

Re: Using reserved words as member variable/method names

2015-09-19 Thread Josh Tynjala
Yeah, I vaguely remember something about the methods not being stored on the prototype too. It makes sense if you consider that stuff we had to add for event listeners to keep the right scope. Regardless, even if it's not on the prototype, it's still accessible like obj["identifierName"], so that'

Re: Using reserved words as member variable/method names

2015-09-18 Thread Alex Harui
OK, thanks for the info. A couple of notes in-line.. On 9/18/15, 4:56 PM, "Josh Tynjala" wrote: > >However, the first one could be rewritten like this, where it's a >variable, >which must be an "identifier" instead of an "identifier name": > >var identifierName = function() {} //error because i

Re: Using reserved words as member variable/method names

2015-09-18 Thread Josh Tynjala
Here's the section on reserved words in the ES5.1 spec: http://www.ecma-international.org/ecma-262/5.1/#sec-7.6.1 And the same section in the ES6 / ES2015 spec: http://www.ecma-international.org/ecma-262/6.0/#sec-reserved-words The rule seems to hinge on whether something is an "identifier" or

Re: Using reserved words as member variable/method names

2015-09-18 Thread Alex Harui
Josh, The key question here is whether is it is not valid AS3 per the language spec, or whether the runtime and/or the compiler won’t let you compile it. AFAICT, what you want to do here is valid AS3 and I would expect the runtime to run the expected ABC code, so it should be possible to get the

Using reserved words as member variable/method names

2015-09-18 Thread Josh Tynjala
JavaScript allows the use of reserved words as members of classes/interfaces, but AS3 does not. In JS and AS3, this is not valid: var var = 5; However, in JS, this is valid: var obj = {}; obj.var = 5; Not in AS3, though. Similarly, these are not valid AS3, but some JS types have methods with