Re: Static initialization

2017-03-20 Thread Justin Mclean
Hi, > Are you sure the Google Closure Compiler will handle code outside methods > "properly". IMO, "loose code" isn't very OO, and may confuse how variable > renaming and dead code removal works. Absolutely no idea but it’s probably easy enough to try and see. Thanks, Justin

Re: Static initialization

2017-03-20 Thread Alex Harui
Are you sure the Google Closure Compiler will handle code outside methods "properly". IMO, "loose code" isn't very OO, and may confuse how variable renaming and dead code removal works. Just wondering... -Alex On 3/20/17, 3:38 PM, "Harbs" wrote: >Even better. > >I don’t know why I never though

Re: Static initialization

2017-03-20 Thread Harbs
Even better. I don’t know why I never thought of trying this stuff. > On Mar 21, 2017, at 12:32 AM, Justin Mclean wrote: > > Hi, > >> I assume anonymous self invoking functions do not work in AS. Right? > > No need for a function you can just put in a static code block like so: > > { > code

Re: Static initialization

2017-03-20 Thread Justin Mclean
Hi, > I assume anonymous self invoking functions do not work in AS. Right? No need for a function you can just put in a static code block like so: { code goes here; } Justin

Re: Static initialization

2017-03-20 Thread Josh Tynjala
Like this? (function() { //do stuff })(); I don't see why not. - Josh On Mon, Mar 20, 2017 at 3:18 PM, Harbs wrote: > Thanks. Right. I should have realized that myself. > > I assume anonymous self invoking functions do not work in AS. Right? > > > On Mar 20, 2017, at 11:55 PM, Josh Tynjal

Re: Static initialization

2017-03-20 Thread Harbs
Thanks. Right. I should have realized that myself. I assume anonymous self invoking functions do not work in AS. Right? > On Mar 20, 2017, at 11:55 PM, Josh Tynjala wrote: > > Sorry, I misspoke. Don't put it in the package block. It should be inside > the class. This is the way to do it: > > h

Re: Static initialization

2017-03-20 Thread Josh Tynjala
Sorry, I misspoke. Don't put it in the package block. It should be inside the class. This is the way to do it: https://paste.apache.org/P1Qq - Josh On Mon, Mar 20, 2017 at 2:53 PM, Josh Tynjala wrote: > I know you can call static functions from inside the package block. Simply > put your loop

Re: Static initialization

2017-03-20 Thread Josh Tynjala
I know you can call static functions from inside the package block. Simply put your loop inside the static function. Here's a simpler example that you should be able to modify to add your loop: https://paste.apache.org/dcVo It's certainly possible that FalconJX will mangle this code when emitting

Static initialization

2017-03-20 Thread Harbs
Is there a good way to initialize static variables? I have a class which has a large static object and I need to initialize about 100 attributes in a loop. It’s actually a class being ported from Javascript. In Javascript, it’s pretty easy to do this. You just write the loop right after declari