You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Greg Dove <gr...@gmail.com> on 2016/09/09 00:07:33 UTC

[FlexJS][Falcon-JX] Reflection related question

Alex this might be a question more for you, unless others are familiar with
the topic.

I am currently doing a bit more on reflection. Instead of outputting the
fully resolved ancestral definition for each class, which would mean a lot
of duplicated output across the inheritance chain, I assumed it would be
best to resolve this at runtime (with caching) in the TypeDefinitions. So
each TypeDefinition lookup would check its ancestors and add to its local
collection of instance based members if they weren't already 'declaredBy'
again (an override), and I envisaged caching the fully resolved
TypeDefinition. This would get to a similar result to flash native
describeType.

so I am adding inheritsFrom into the output like so:

MyInitialView.prototype.FLEXJS_REFLECTION_INFO = function () {
  return {
    inheritsFrom: function () {
      return [ 'org.apache.flex.core.View',
'org.apache.flex.core.ViewBase', 'org.apache.flex.core.ContainerBase',
'org.apache.flex.core.UIBase', 'org.apache.flex.core.HTMLElementWrapper',
'flash.display.Sprite', 'flash.display.DisplayObjectContainer',
'flash.display.InteractiveObject', 'flash.display.DisplayObject',
'flash.events.EventDispatcher', 'Object' ] ;
    },

But it seems that the framework swc library only provides the flash version
of the inheritance chain for this, because jx sees the flash.display.*
classes in the loaded typedefinitions. Is there any way the compiler can
load the definitions that were used when the js part of the swc was
compiled for jx? I suspect not at the moment, but I'm just checking that I
am not missing something obvious.....

Re: [FlexJS][Falcon-JX] Reflection related question

Posted by Greg Dove <gr...@gmail.com>.
Alex, fyi if you are checking the refleciton stuff out, you should find

trace(typeDefInstance.toString(true));

to be quite helpful. This gives a full representation of the reflected
content.



On Tue, Sep 27, 2016 at 7:57 PM, Greg Dove <gr...@gmail.com> wrote:

> I have gotten half of it in. :) I pushed the compiler updates.
>
> I had some problem with pushing to asjs repo to get the framework
> updates/manualtests update. I will figure this out later this evening my
> time.
>
>
> cheers
> Greg
>
> On Wed, Sep 21, 2016 at 6:35 PM, Alex Harui <ah...@adobe.com> wrote:
>
>>
>>
>> On 9/20/16, 10:58 PM, "Greg Dove" <gr...@gmail.com> wrote:
>>
>> >I am going to avoid setting too many expectations about timing for this
>> >stuff in the future :)
>> >
>> >I'm still working on this, just in case you wondered, but have had to
>> >balance my time out with income-related work.
>>
>> Honestly, Apache is such that I don't spend too much time expecting folks
>> to contribute at any particular level.  We are all theoretically
>> volunteers.  We don't have very many deadlines or schedules to worry
>> about.
>>
>> We'll be happy to see it when you get around to it.  And lots of things
>> get started and not finished yet around here, so no big deal if life gets
>> in the way.
>>
>> -Alex
>>
>>
>

Re: [FlexJS][Falcon-JX] Reflection related question

Posted by Greg Dove <gr...@gmail.com>.
I have gotten half of it in. :) I pushed the compiler updates.

I had some problem with pushing to asjs repo to get the framework
updates/manualtests update. I will figure this out later this evening my
time.


cheers
Greg

On Wed, Sep 21, 2016 at 6:35 PM, Alex Harui <ah...@adobe.com> wrote:

>
>
> On 9/20/16, 10:58 PM, "Greg Dove" <gr...@gmail.com> wrote:
>
> >I am going to avoid setting too many expectations about timing for this
> >stuff in the future :)
> >
> >I'm still working on this, just in case you wondered, but have had to
> >balance my time out with income-related work.
>
> Honestly, Apache is such that I don't spend too much time expecting folks
> to contribute at any particular level.  We are all theoretically
> volunteers.  We don't have very many deadlines or schedules to worry about.
>
> We'll be happy to see it when you get around to it.  And lots of things
> get started and not finished yet around here, so no big deal if life gets
> in the way.
>
> -Alex
>
>

Re: [FlexJS][Falcon-JX] Reflection related question

Posted by Alex Harui <ah...@adobe.com>.

On 9/20/16, 10:58 PM, "Greg Dove" <gr...@gmail.com> wrote:

>I am going to avoid setting too many expectations about timing for this
>stuff in the future :)
>
>I'm still working on this, just in case you wondered, but have had to
>balance my time out with income-related work.

Honestly, Apache is such that I don't spend too much time expecting folks
to contribute at any particular level.  We are all theoretically
volunteers.  We don't have very many deadlines or schedules to worry about.

We'll be happy to see it when you get around to it.  And lots of things
get started and not finished yet around here, so no big deal if life gets
in the way.

-Alex


Re: [FlexJS][Falcon-JX] Reflection related question

Posted by Greg Dove <gr...@gmail.com>.
I am going to avoid setting too many expectations about timing for this
stuff in the future :)

I'm still working on this, just in case you wondered, but have had to
balance my time out with income-related work.

Just so you know where I am heading with this, I got it to a minimum level
where I could do this [1], which was why I wanted to focus on reflection -
I wanted a way to run Flexunit-like tests in both targets side-by-side.
These are only very simple Assertion tests (synchronous only for now) and
the goal is to have them flexunit-compatible, so they should drop into the
build without changes to run via flexunit at build time. Maybe in time
a more complete set of functionality can be added, included async tests etc.
I am now working through various other reflection issues (some compiler,
some framework) and I will get this in when I feel it is 'right' - which
shouldn't be too much longer!

cheers
Greg

1. https://dl.dropboxusercontent.com/u/13816570/2016-09-21_1746.png





On Wed, Sep 14, 2016 at 6:15 PM, Alex Harui <ah...@adobe.com> wrote:

> OK, looking forward to seeing it.
>
> -Alex
>
> On 9/13/16, 10:58 PM, "Greg Dove" <gr...@gmail.com> wrote:
>
> >Alex, just a quick update on this....
> >I didn't get to work on this as much over the weekend as I'd hoped, but I
> >have progressed it since. I iterated through a few different approaches
> >for
> >various aspects of the reflection stuff, but I have settled on what I
> >think
> >is a good output type for js, There was (as there always is) a bit more to
> >it than I'd thought, but I am getting there. I also encountered some
> >unrelated js output bugs (missing goog.requires causing some things to be
> >undefined) which I have been distracted by today and have also made
> >progress on.
> >
> >Anyhow, I will test things a bit more tomorrow and hopefully have
> >something
> >I can push towards the end of tomorrow. If not, I expect it will be the
> >following day.
> >
> >cheers,
> >Greg
> >
> >
> >
> >On Fri, Sep 9, 2016 at 5:04 PM, Greg Dove <gr...@gmail.com> wrote:
> >
> >> Good to know. Pretty sure there is nothing outside of reflection here,
> >>so
> >> that sounds great.- thanks
> >>
> >>
> >> On Fri, Sep 9, 2016 at 4:59 PM, Alex Harui <ah...@adobe.com> wrote:
> >>
> >>>
> >>>
> >>> On 9/8/16, 9:50 PM, "Greg Dove" <gr...@gmail.com> wrote:
> >>>
> >>> >What is your preference for me getting this into the repo? If all
> >>>current
> >>> >(updated) tests pass and nothing else seems broken is it ok if I push
> >>>to
> >>> >develop for jx and asjs? Or do you prefer I go to branches on both
> >>>until
> >>> >it
> >>> >can be checked by you or others - it will be something where both
> >>>repos
> >>> >will  need to update at the same time I think.
> >>> >
> >>>
> >>> If there is little risk it will break things not related to
> >>>reflection, I
> >>> would just check it in.  Not too many folks are using reflection.  IMO,
> >>> remote branches are for sharing work in progress: things that will take
> >>> several days and commits to get done.  If you are all done except for a
> >>> bug or two, it can just go in, especially this early in the next
> >>>release
> >>> cycle.
> >>>
> >>> We get commit emails and are supposed to review then anyway.
> >>>
> >>> -Alex
> >>>
> >>>
> >>
>
>

Re: [FlexJS][Falcon-JX] Reflection related question

Posted by Alex Harui <ah...@adobe.com>.
OK, looking forward to seeing it.

-Alex

On 9/13/16, 10:58 PM, "Greg Dove" <gr...@gmail.com> wrote:

>Alex, just a quick update on this....
>I didn't get to work on this as much over the weekend as I'd hoped, but I
>have progressed it since. I iterated through a few different approaches
>for
>various aspects of the reflection stuff, but I have settled on what I
>think
>is a good output type for js, There was (as there always is) a bit more to
>it than I'd thought, but I am getting there. I also encountered some
>unrelated js output bugs (missing goog.requires causing some things to be
>undefined) which I have been distracted by today and have also made
>progress on.
>
>Anyhow, I will test things a bit more tomorrow and hopefully have
>something
>I can push towards the end of tomorrow. If not, I expect it will be the
>following day.
>
>cheers,
>Greg
>
>
>
>On Fri, Sep 9, 2016 at 5:04 PM, Greg Dove <gr...@gmail.com> wrote:
>
>> Good to know. Pretty sure there is nothing outside of reflection here,
>>so
>> that sounds great.- thanks
>>
>>
>> On Fri, Sep 9, 2016 at 4:59 PM, Alex Harui <ah...@adobe.com> wrote:
>>
>>>
>>>
>>> On 9/8/16, 9:50 PM, "Greg Dove" <gr...@gmail.com> wrote:
>>>
>>> >What is your preference for me getting this into the repo? If all
>>>current
>>> >(updated) tests pass and nothing else seems broken is it ok if I push
>>>to
>>> >develop for jx and asjs? Or do you prefer I go to branches on both
>>>until
>>> >it
>>> >can be checked by you or others - it will be something where both
>>>repos
>>> >will  need to update at the same time I think.
>>> >
>>>
>>> If there is little risk it will break things not related to
>>>reflection, I
>>> would just check it in.  Not too many folks are using reflection.  IMO,
>>> remote branches are for sharing work in progress: things that will take
>>> several days and commits to get done.  If you are all done except for a
>>> bug or two, it can just go in, especially this early in the next
>>>release
>>> cycle.
>>>
>>> We get commit emails and are supposed to review then anyway.
>>>
>>> -Alex
>>>
>>>
>>


Re: [FlexJS][Falcon-JX] Reflection related question

Posted by Greg Dove <gr...@gmail.com>.
Alex, just a quick update on this....
I didn't get to work on this as much over the weekend as I'd hoped, but I
have progressed it since. I iterated through a few different approaches for
various aspects of the reflection stuff, but I have settled on what I think
is a good output type for js, There was (as there always is) a bit more to
it than I'd thought, but I am getting there. I also encountered some
unrelated js output bugs (missing goog.requires causing some things to be
undefined) which I have been distracted by today and have also made
progress on.

Anyhow, I will test things a bit more tomorrow and hopefully have something
I can push towards the end of tomorrow. If not, I expect it will be the
following day.

cheers,
Greg



On Fri, Sep 9, 2016 at 5:04 PM, Greg Dove <gr...@gmail.com> wrote:

> Good to know. Pretty sure there is nothing outside of reflection here, so
> that sounds great.- thanks
>
>
> On Fri, Sep 9, 2016 at 4:59 PM, Alex Harui <ah...@adobe.com> wrote:
>
>>
>>
>> On 9/8/16, 9:50 PM, "Greg Dove" <gr...@gmail.com> wrote:
>>
>> >What is your preference for me getting this into the repo? If all current
>> >(updated) tests pass and nothing else seems broken is it ok if I push to
>> >develop for jx and asjs? Or do you prefer I go to branches on both until
>> >it
>> >can be checked by you or others - it will be something where both repos
>> >will  need to update at the same time I think.
>> >
>>
>> If there is little risk it will break things not related to reflection, I
>> would just check it in.  Not too many folks are using reflection.  IMO,
>> remote branches are for sharing work in progress: things that will take
>> several days and commits to get done.  If you are all done except for a
>> bug or two, it can just go in, especially this early in the next release
>> cycle.
>>
>> We get commit emails and are supposed to review then anyway.
>>
>> -Alex
>>
>>
>

Re: [FlexJS][Falcon-JX] Reflection related question

Posted by Greg Dove <gr...@gmail.com>.
Good to know. Pretty sure there is nothing outside of reflection here, so
that sounds great.- thanks


On Fri, Sep 9, 2016 at 4:59 PM, Alex Harui <ah...@adobe.com> wrote:

>
>
> On 9/8/16, 9:50 PM, "Greg Dove" <gr...@gmail.com> wrote:
>
> >What is your preference for me getting this into the repo? If all current
> >(updated) tests pass and nothing else seems broken is it ok if I push to
> >develop for jx and asjs? Or do you prefer I go to branches on both until
> >it
> >can be checked by you or others - it will be something where both repos
> >will  need to update at the same time I think.
> >
>
> If there is little risk it will break things not related to reflection, I
> would just check it in.  Not too many folks are using reflection.  IMO,
> remote branches are for sharing work in progress: things that will take
> several days and commits to get done.  If you are all done except for a
> bug or two, it can just go in, especially this early in the next release
> cycle.
>
> We get commit emails and are supposed to review then anyway.
>
> -Alex
>
>

Re: [FlexJS][Falcon-JX] Reflection related question

Posted by Alex Harui <ah...@adobe.com>.

On 9/8/16, 9:50 PM, "Greg Dove" <gr...@gmail.com> wrote:

>What is your preference for me getting this into the repo? If all current
>(updated) tests pass and nothing else seems broken is it ok if I push to
>develop for jx and asjs? Or do you prefer I go to branches on both until
>it
>can be checked by you or others - it will be something where both repos
>will  need to update at the same time I think.
>

If there is little risk it will break things not related to reflection, I
would just check it in.  Not too many folks are using reflection.  IMO,
remote branches are for sharing work in progress: things that will take
several days and commits to get done.  If you are all done except for a
bug or two, it can just go in, especially this early in the next release
cycle.

We get commit emails and are supposed to review then anyway.

-Alex


Re: [FlexJS][Falcon-JX] Reflection related question

Posted by Greg Dove <gr...@gmail.com>.
I've just followed your lead here, you had done a lot of the initial work
already, so I didn't have to figure out the 'how to do' part, just bits of
the 'what to do'.
So far I have added optional caching (TypeDefinition.useCache), but it is
currently not on by default (I haven't actually gotten to testing it yet).
And the variables and methods arrays etc will respect the same setting, but
are always returned via Array.slice() from their getters so there shouldn't
be any possibility to mess with the cached definitions (the individual
reflection objects are ready-only, so its just the arrays that are a
concern here I think).

I think the caching might be a good idea to speed things up for when we
need this to support any serialization/deserialization such as for amf when
Chris gets to it. I am pretty sure js will need all the help it can get for
that. I think we could also consider sort of custom json objectEncoding as
well in the future that might be an extra option here. I have worked with
some json in the past with ___type:"qName here" fields as a sort of
approach for this, but I don't know if there is anything semi-standard here.


Anyhow, this is going to be a little like the Binding updates, there will
be changes in the compiler (jx only this time) and in the framework.... I
expect to finish it up over the weekend and should have something by Monday
your time.

What is your preference for me getting this into the repo? If all current
(updated) tests pass and nothing else seems broken is it ok if I push to
develop for jx and asjs? Or do you prefer I go to branches on both until it
can be checked by you or others - it will be something where both repos
will  need to update at the same time I think.



On Fri, Sep 9, 2016 at 4:23 PM, Alex Harui <ah...@adobe.com> wrote:

>
>
> On 9/8/16, 5:39 PM, "Greg Dove" <gr...@gmail.com> wrote:
>
> >"Alex if you have a different view of how this should work, please let me
> >know."
> >
> >Sorry I have been to long in the compiler. I see what is needed in the
> >framework code now. I will just use what is there. :)
> >
>
> Sounds good.  There is trade-off between how much reflection info we add
> to the output vs how long it takes the reflection library to compute the
> answer.  I personally  don't care how long it takes the reflection library
> to compute the answer, it just has to be possible, but others might have
> different opinions.
>
> Looking forward to what you come up with.
>
> -Alex
>
>

Re: [FlexJS][Falcon-JX] Reflection related question

Posted by Alex Harui <ah...@adobe.com>.

On 9/8/16, 5:39 PM, "Greg Dove" <gr...@gmail.com> wrote:

>"Alex if you have a different view of how this should work, please let me
>know."
>
>Sorry I have been to long in the compiler. I see what is needed in the
>framework code now. I will just use what is there. :)
>

Sounds good.  There is trade-off between how much reflection info we add
to the output vs how long it takes the reflection library to compute the
answer.  I personally  don't care how long it takes the reflection library
to compute the answer, it just has to be possible, but others might have
different opinions.

Looking forward to what you come up with.

-Alex


Re: [FlexJS][Falcon-JX] Reflection related question

Posted by Greg Dove <gr...@gmail.com>.
"Alex if you have a different view of how this should work, please let me
know."

Sorry I have been to long in the compiler. I see what is needed in the
framework code now. I will just use what is there. :)




On Fri, Sep 9, 2016 at 12:32 PM, Greg Dove <gr...@gmail.com> wrote:

> Actually I think the safest thing to do here would be to output the
> immediate base class, I *think* that should always work correctly. And that
> is all I need to follow the inheritance chain and collect the inherited
> members for the higher level TypeDefinition. Alex if you have a different
> view of how this should work, please let me know.
>
>
>
>
> On Fri, Sep 9, 2016 at 12:19 PM, Greg Dove <gr...@gmail.com> wrote:
>
>> Never mind, I think I don't need to do this output. It looks like I can
>> simply use constructor.superClass in js and go recursive. Please ignore.
>>
>>
>>
>> On Fri, Sep 9, 2016 at 12:07 PM, Greg Dove <gr...@gmail.com> wrote:
>>
>>> Alex this might be a question more for you, unless others are familiar
>>> with the topic.
>>>
>>> I am currently doing a bit more on reflection. Instead of outputting the
>>> fully resolved ancestral definition for each class, which would mean a lot
>>> of duplicated output across the inheritance chain, I assumed it would be
>>> best to resolve this at runtime (with caching) in the TypeDefinitions. So
>>> each TypeDefinition lookup would check its ancestors and add to its local
>>> collection of instance based members if they weren't already 'declaredBy'
>>> again (an override), and I envisaged caching the fully resolved
>>> TypeDefinition. This would get to a similar result to flash native
>>> describeType.
>>>
>>> so I am adding inheritsFrom into the output like so:
>>>
>>> MyInitialView.prototype.FLEXJS_REFLECTION_INFO = function () {
>>>   return {
>>>     inheritsFrom: function () {
>>>       return [ 'org.apache.flex.core.View',
>>> 'org.apache.flex.core.ViewBase', 'org.apache.flex.core.ContainerBase',
>>> 'org.apache.flex.core.UIBase', 'org.apache.flex.core.HTMLElementWrapper',
>>> 'flash.display.Sprite', 'flash.display.DisplayObjectContainer',
>>> 'flash.display.InteractiveObject', 'flash.display.DisplayObject',
>>> 'flash.events.EventDispatcher', 'Object' ] ;
>>>     },
>>>
>>> But it seems that the framework swc library only provides the flash
>>> version of the inheritance chain for this, because jx sees the
>>> flash.display.* classes in the loaded typedefinitions. Is there any way the
>>> compiler can load the definitions that were used when the js part of the
>>> swc was compiled for jx? I suspect not at the moment, but I'm just checking
>>> that I am not missing something obvious.....
>>>
>>>
>>>
>>
>

Re: [FlexJS][Falcon-JX] Reflection related question

Posted by Greg Dove <gr...@gmail.com>.
Actually I think the safest thing to do here would be to output the
immediate base class, I *think* that should always work correctly. And that
is all I need to follow the inheritance chain and collect the inherited
members for the higher level TypeDefinition. Alex if you have a different
view of how this should work, please let me know.




On Fri, Sep 9, 2016 at 12:19 PM, Greg Dove <gr...@gmail.com> wrote:

> Never mind, I think I don't need to do this output. It looks like I can
> simply use constructor.superClass in js and go recursive. Please ignore.
>
>
>
> On Fri, Sep 9, 2016 at 12:07 PM, Greg Dove <gr...@gmail.com> wrote:
>
>> Alex this might be a question more for you, unless others are familiar
>> with the topic.
>>
>> I am currently doing a bit more on reflection. Instead of outputting the
>> fully resolved ancestral definition for each class, which would mean a lot
>> of duplicated output across the inheritance chain, I assumed it would be
>> best to resolve this at runtime (with caching) in the TypeDefinitions. So
>> each TypeDefinition lookup would check its ancestors and add to its local
>> collection of instance based members if they weren't already 'declaredBy'
>> again (an override), and I envisaged caching the fully resolved
>> TypeDefinition. This would get to a similar result to flash native
>> describeType.
>>
>> so I am adding inheritsFrom into the output like so:
>>
>> MyInitialView.prototype.FLEXJS_REFLECTION_INFO = function () {
>>   return {
>>     inheritsFrom: function () {
>>       return [ 'org.apache.flex.core.View', 'org.apache.flex.core.ViewBase',
>> 'org.apache.flex.core.ContainerBase', 'org.apache.flex.core.UIBase',
>> 'org.apache.flex.core.HTMLElementWrapper', 'flash.display.Sprite',
>> 'flash.display.DisplayObjectContainer', 'flash.display.InteractiveObject',
>> 'flash.display.DisplayObject', 'flash.events.EventDispatcher', 'Object'
>> ] ;
>>     },
>>
>> But it seems that the framework swc library only provides the flash
>> version of the inheritance chain for this, because jx sees the
>> flash.display.* classes in the loaded typedefinitions. Is there any way the
>> compiler can load the definitions that were used when the js part of the
>> swc was compiled for jx? I suspect not at the moment, but I'm just checking
>> that I am not missing something obvious.....
>>
>>
>>
>

Re: [FlexJS][Falcon-JX] Reflection related question

Posted by Greg Dove <gr...@gmail.com>.
Never mind, I think I don't need to do this output. It looks like I can
simply use constructor.superClass in js and go recursive. Please ignore.



On Fri, Sep 9, 2016 at 12:07 PM, Greg Dove <gr...@gmail.com> wrote:

> Alex this might be a question more for you, unless others are familiar
> with the topic.
>
> I am currently doing a bit more on reflection. Instead of outputting the
> fully resolved ancestral definition for each class, which would mean a lot
> of duplicated output across the inheritance chain, I assumed it would be
> best to resolve this at runtime (with caching) in the TypeDefinitions. So
> each TypeDefinition lookup would check its ancestors and add to its local
> collection of instance based members if they weren't already 'declaredBy'
> again (an override), and I envisaged caching the fully resolved
> TypeDefinition. This would get to a similar result to flash native
> describeType.
>
> so I am adding inheritsFrom into the output like so:
>
> MyInitialView.prototype.FLEXJS_REFLECTION_INFO = function () {
>   return {
>     inheritsFrom: function () {
>       return [ 'org.apache.flex.core.View', 'org.apache.flex.core.ViewBase',
> 'org.apache.flex.core.ContainerBase', 'org.apache.flex.core.UIBase',
> 'org.apache.flex.core.HTMLElementWrapper', 'flash.display.Sprite',
> 'flash.display.DisplayObjectContainer', 'flash.display.InteractiveObject',
> 'flash.display.DisplayObject', 'flash.events.EventDispatcher', 'Object' ]
> ;
>     },
>
> But it seems that the framework swc library only provides the flash
> version of the inheritance chain for this, because jx sees the
> flash.display.* classes in the loaded typedefinitions. Is there any way the
> compiler can load the definitions that were used when the js part of the
> swc was compiled for jx? I suspect not at the moment, but I'm just checking
> that I am not missing something obvious.....
>
>
>