On 11/16/15, 10:36 AM, "Josh Tynjala" <joshtynj...@gmail.com> wrote:

>The Immediately-Invoked Function Expression (IIFE) pattern could be used
>to
>create private classes.
>
>some.package.SomeClass = (function()
>{
>    var SomeHelperClass = function(){};
>
>    var SomeClass = function(){};
>
>    return SomeClass;
>})();
>
>SomeHelperClass will only be accessible inside the (function(){}).
>SomeClass will be returned to allow it to be exposed externally. It's a
>pretty common pattern in JavaScript to avoid polluting the global
>namespace.

Thanks for the suggestion.  Would that work for method access?  For
example:

package some.package
{
   public class SomeClass
   {
      public method someMethod()
      {
        var foo:SomeHelperClass = new SomeHelperClass();
      }
   }
}

class SomeHelperClass
{
}



Right now, someMethod is generated as:

some.package.SomeClass.prototype.someMethod = function()
{
}

Would it have to go within the outer function?  That might be a lot of
compiler work.

-Alex

Reply via email to