You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@royale.apache.org by Serkan Taş <se...@likyateknoloji.com> on 2018/02/15 20:58:35 UTC

project package structure

Hi,

My package naming convention of flex mxl files has java-like structure.

is it good for Royale ?



Re: project package structure

Posted by Alex Harui <ah...@adobe.com>.
Whatever package naming you use in Flex should work in Royale.  Depending
on what level of optimization you ask for in Royale, packages can be
collapsed in the final output.  That's usually ok, but I'll bet we still
have a bug or two around that.

Not required reading below...

Under the hood, an ActionScript package is just a string.  When you have
code in ActionScript like:

  new org.apache.royale.Foo();

The compiler simply generates:

  FindAClassCalled "org.apache.flex.royale::Foo"
  NewInstance

It doesn't matter too much how long the package name is or how many dots
it has in it.  However, in JavaScript, the output code is pretty much the
same as the source:

  new org.apache.royale.Foo();

And that means the JavaScript runtime has to do something like:

  Register a = window;
  a = a["org"];
  a = a["apache"];
  a = a["royale"];
  a = a["Foo"];
  NewInstance

As you can see, the number of dots in the package name change the number
of lookups before instantiation.  So, the JavaScript optimizer collapses
package names.  It generates additional code like:

  window["AJ"] = org.apache.royale.Foo();

And converts the output to:

  new AJ();

Which is fewer lookups and faster and smaller if you have several places
in the JS file where the string "org.apache.royale.Foo" can be replaced by
"AJ".  But our Reflection and DataBinding libraries still have to work
from the original strings so I wouldn't be surprised if there is a bug in
there.

HTH,
-Alex

On 2/15/18, 12:58 PM, "Serkan Taş" <se...@likyateknoloji.com> wrote:

>Hi,
>
>My package naming convention of flex mxl files has java-like structure.
>
>is it good for Royale ?
>
>