You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Alex Harui <ah...@adobe.com> on 2015/11/10 00:28:58 UTC

[FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Renaming the thread

On 11/9/15, 1:12 PM, "Harbs" <ha...@gmail.com> wrote:

>Well, I’d be interested in your findings.
>
>If operator definitions is possible .. will be easier than . operators.
>If we allow single dot operators, it will be difficult to differentiate
>between E4X syntax and function calls. I’d really like to drop the () on
>length and some of the other methods… Those are a course for very common
>errors.

Maybe we aren’t talking about the same thing, but let me explain in more
detail what I’m saying.

Here is some E4x:

    var a:XML = new XML(\"<top attr1='cat'><child attr2='dog'><grandchild
attr3='fish'>text</grandchild></child></top>\”);
    var b:XMLList = a..child;
    var c:XMLList = a..grandchild.(@attr2 == 'fish');


(It would be nice to have others add in their favorite or common scenarios
if they are different).

The compiler already understands the “..” as well as the “@“.  The way
Falcon and FalconJX works is that there is a parsing phase that takes your
source code and creates a tree of different kinds of nodes (ClassNodes,
FunctionNodes, FunctionCallNodes, OperatorNodes,
MemberAccessExpressionNodes, etc).  Falcon then walks the tree and
converts these nodes to ABC.  FalconJX walks the tree and outputs
JavaScript.

I just ran a test and the above code was parsed into a tree where the “..”
was the operator for a MemberAccessExpression. The “@“ was converted into
a unary operator for an E4xFilter operator for another
MemberAccessExpression.  This is good for FalconJX, because that means we
understand the semantics of this syntax and can then generate any
JavaScript we want.

IMO, given that folks are already wishing for a more Spark and MX-like
component set, I think we should try to mimic as much of E4x as possible
as opposed to inventing a new API that folks would have to migrate to.
Performance-wise, I still think it would be worth everyone’s time to
convert XML to JSON, but there are probably folks who can’t move.

Given that FlexJS leverages the concept of replacing abstractions, if you
create an XML and XMLList class in JavaScript and populate them with the
same APIs as ActionScript, lots of things should work.  The FalconJX
compiler could easily be taught to convert “a..child” into
“a.descendants()”.  If the JS version has an extra filter() function, then
FalconJX would convert

  a..grandchild.(@attr2 == 'fish’)

into 

  a.descendants().filter(function (node) { return
node.attribute(‘fish’).length() })

or something like that.

I think the part of XML in ActionScript that isn’t practical to do in
JavaScript is handling change notifications.  It might be possible to do
some of it for known properties but I think it would be fragile.

For example:

  var d:XML = a..child[0];
  d.foo = <bar />;

In ActionScript you can get a change notification when foo is assigned.
With a bunch of work, if we know you are setting “foo” (which we do know
in this case) I think we could use Object.defineProperty to define a
property on d.

What we can’t easily do is:

  var d:XML = a..child[0];
  var s:String = “someRandomPropertyName”;
  d[s] = <bar />;

If we don’t know what ’s’ is, we can’t define properties early on the XML
node.  I suppose with even more code we could generate code for that.

BTW, for any sort of solution, we would have to know that “d” is XML and
not Object and that would require more careful type handling in the code
our customers write.  If you have:


  public class MyClass extends EventDispatcher
  {
      public var someProp:XML;
  }

Then in some other class you have:

  var instance:MyClass = new MyClass();
  instance.addEventListener(“someEvent”, myHandler);

  function myHandler(event:Event):void
  {
      event.target.someProp.foo = <newnode />;
  }
  
We have lost the notion that someProp is XML and not Object because
event.target is defined as Object and not MyClass.  Folks will have to fix
up their code to be:

      (event.target as MyClass).someProp.foo = <newnode />;

Which won’t be much fun and if you miss one, you won’t get a compile error.

FWIW, we could probably put in a warning if you forget () on “length”,
again if we know that length is being access on an XML node and not Object.

HTH,
-Alex



Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 11/10/15, 8:54 AM, "Jim Norris" <ji...@e-work.com> wrote:

>Backward compatibility with our large set of deployed (XML based) content
>is critical, so very likely JS rather than JSON.

Follow up:  I agree that you wouldn’t want to change what is stored in the
database.  I’m probing the notion of whether you could/would/should
convert the XML to JSON before sending up to the client (and convert from
JSON back to XML when the data comes back).  Depending on the complexity
of the data, you could reap significant performance and bandwidth gains by
grabbing some Java library and converting your XML to JSON before sending
the data to the client.

Here’s one article [1].  That said, I’m a client guy and totally out of my
area of expertise on these matters.  Either way, I think we’ll keep
looking into how much of e4x we can do on the JS side.

Thanks,
-Alex

[1] http://digitalbazaar.com/2010/11/22/json-vs-xml/


RE: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Jim Norris <ji...@e-work.com>.
Backward compatibility with our large set of deployed (XML based) content is critical, so very likely JS rather than JSON.


Jim

-----Original Message-----
From: Alex Harui [mailto:aharui@adobe.com] 
Sent: Tuesday, November 10, 2015 11:36 AM
To: dev@flex.apache.org
Subject: Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Thanks Jim,

We’ll keep that in mind.  Just curious, if FlexJS didn’t exist and you had to use some other JS framework, would you port all of your XML handling to JS or switch over to JSON?  Other folks with XML backend are welcome to add their thoughts as well.

-Alex

On 11/10/15, 8:30 AM, "Jim Norris" <ji...@e-work.com> wrote:

>Hello,
>
>I have been observing the progress on FlexJS as I am the developer for 
>an application built with Flex that my company deploys into large 
>enterprises.
>
>We have XML based content and use a significant number of E4X 
>expressions, so if there is a way to simplify the conversion of these 
>expressions to Flex JS that would certainly make an eventual conversion 
>of our application simpler.  We also use the XML.hasOwnProperty method 
>to detect the existence of attributes that are used as configuration 
>switches in the XML.
>
>
>
>
>Thanks,
>
>Jim Norris
>
>www.e-Work.com
>
>
>-----Original Message-----
>From: Alex Harui [mailto:aharui@adobe.com]
>Sent: Tuesday, November 10, 2015 11:07 AM
>To: dev@flex.apache.org
>Subject: Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back 
>port)
>
>Also, don’t spend too long on trying to create an XML class in the 
>default package.  You can just code it in some package and manually map 
>it for now.  And maybe we’ll just end up having the compiler inject the 
>mapping if that turns out to be easier.
>
>-Alex
>
>On 11/10/15, 6:18 AM, "Alex Harui" <ah...@adobe.com> wrote:
>
>>The key is in the build.xml and compile-asjs-config.xml in any of the 
>>already-backported SWCs.  The js.swc from Falcon is used instead of 
>>playerglobal.swc/airglobal.swc.  I have not tried to swap out a class 
>>in the default package yet, but it should be doable.  We might need a 
>>compiler change if there are assumptions.  And I have no idea if FB is 
>>making any assumptions.
>>
>>I forgot to add to that wiki page how to deal with platform-only 
>>components.  I will add that this morning, but basically, you should 
>>add them to the as/src/XXXClasses.as and put COMPILE::JS or
>>COMPILE::AS3 around it.  There are examples, especially in the 
>>Core.swc and HTML.swc.
>>
>>FWIW, I don’t know why you can’t go from XML to JSON and back to XML.
>>Both are hierarchical data structures.  In the Flex SDK we have 
>>SOAPDecoder and SOAPEncoder that take XML to data objects and back, 
>>and generally that performs better if you are going to access a 
>>significant percentage of the data.
>>
>>HTH,
>>-Alex
>>
>>On 11/10/15, 3:45 AM, "Harbs" <ha...@gmail.com> wrote:
>>
>>>I’m a bit stumped here. We have externs for HTML and native 
>>>javascript APIs. Right? How do I import these externs so these 
>>>classes are recognized when using COMPILE::JS?
>>>
>>>Actually, I just searched for DOMParser and createHTMLDocument.
>>>Neither searched turned anything up in FlexJS. So I’m wondering if I 
>>>was wrong about having externs for this.
>>>
>>>On Nov 10, 2015, at 10:48 AM, Harbs <ha...@gmail.com> wrote:
>>>
>>>> I’m going to have to do some fancy footwork to get this working.
>>>>Flash Builder is complaining that palyerglobal.swc already exists 
>>>>whe I try to create an XML class in the default package.
>>>> 
>>>> Any ideas on how to do this?
>>>> 
>>>> On Nov 10, 2015, at 9:39 AM, Harbs <ha...@gmail.com> wrote:
>>>> 
>>>>> OK. This approach is different than the approach I started on, but 
>>>>>it could be workable.
>>>>> 
>>>>> I was going down the road where there would be a set of single new 
>>>>>classes which would proxy to XML and Document in Flash and HTML 
>>>>>respectively. You are suggesting we stick with XML and XMLList for 
>>>>>Flash and create new JS versions with the same public API as XML 
>>>>>and XMLList.
>>>>> 
>>>>> Where would you go about creating those JS classes? Would I just 
>>>>>out it in an “as” folder and wrap the whole class in a COMPILE::JS?
>>>>>Also, what package would this go into? I’m assuming none, since XML 
>>>>>and XMLList are both top level classes.
>>>>> 
>>>>> BTW, I need to read and write XML files, so yeah, converting to 
>>>>>JSON is not an option.
>>>>> 
>>>>> On Nov 10, 2015, at 1:28 AM, Alex Harui <ah...@adobe.com> wrote:
>>>>> 
>>>>>> Renaming the thread
>>>>>> 
>>>>>> On 11/9/15, 1:12 PM, "Harbs" <ha...@gmail.com> wrote:
>>>>>> 
>>>>>>> Well, I’d be interested in your findings.
>>>>>>> 
>>>>>>> If operator definitions is possible .. will be easier than .
>>>>>>>operators.
>>>>>>> If we allow single dot operators, it will be difficult to 
>>>>>>>differentiate  between E4X syntax and function calls. I’d really 
>>>>>>>like to drop the
>>>>>>>() on
>>>>>>> length and some of the other methods… Those are a course for 
>>>>>>>very common  errors.
>>>>>> 
>>>>>> Maybe we aren’t talking about the same thing, but let me explain 
>>>>>>in more  detail what I’m saying.
>>>>>> 
>>>>>> Here is some E4x:
>>>>>> 
>>>>>> var a:XML = new XML(\"<top attr1='cat'><child 
>>>>>> attr2='dog'><grandchild 
>>>>>> attr3='fish'>text</grandchild></child></top>\”);
>>>>>> var b:XMLList = a..child;
>>>>>> var c:XMLList = a..grandchild.(@attr2 == 'fish');
>>>>>> 
>>>>>> 
>>>>>> (It would be nice to have others add in their favorite or common 
>>>>>>scenarios  if they are different).
>>>>>> 
>>>>>> The compiler already understands the “..” as well as the “@“.  
>>>>>>The way  Falcon and FalconJX works is that there is a parsing 
>>>>>>phase that takes your  source code and creates a tree of different 
>>>>>>kinds of nodes (ClassNodes,  FunctionNodes, FunctionCallNodes, 
>>>>>>OperatorNodes,  MemberAccessExpressionNodes, etc).  Falcon then 
>>>>>>walks the tree and  converts these nodes to ABC.  FalconJX walks 
>>>>>>the tree and outputs  JavaScript.
>>>>>> 
>>>>>> I just ran a test and the above code was parsed into a tree where 
>>>>>>the “..”
>>>>>> was the operator for a MemberAccessExpression. The “@“ was 
>>>>>>converted into  a unary operator for an E4xFilter operator for 
>>>>>>another  MemberAccessExpression.  This is good for FalconJX, 
>>>>>>because that means we  understand the semantics of this syntax and 
>>>>>>can then generate any  JavaScript we want.
>>>>>> 
>>>>>> IMO, given that folks are already wishing for a more Spark and 
>>>>>>MX-like  component set, I think we should try to mimic as much of 
>>>>>>E4x as possible  as opposed to inventing a new API that folks 
>>>>>>would have to migrate to.
>>>>>> Performance-wise, I still think it would be worth everyone’s time 
>>>>>>to  convert XML to JSON, but there are probably folks who can’t move.
>>>>>> 
>>>>>> Given that FlexJS leverages the concept of replacing 
>>>>>>abstractions, if you  create an XML and XMLList class in 
>>>>>>JavaScript and populate them with the  same APIs as ActionScript, 
>>>>>>lots of things should work.  The FalconJX  compiler could easily 
>>>>>>be taught to convert “a..child” into  “a.descendants()”.  If the 
>>>>>>JS version has an extra
>>>>>>filter() function, then  FalconJX would convert
>>>>>> 
>>>>>> a..grandchild.(@attr2 == 'fish’)
>>>>>> 
>>>>>> into
>>>>>> 
>>>>>> a.descendants().filter(function (node) { return
>>>>>> node.attribute(‘fish’).length() })
>>>>>> 
>>>>>> or something like that.
>>>>>> 
>>>>>> I think the part of XML in ActionScript that isn’t practical to 
>>>>>>do in  JavaScript is handling change notifications.  It might be 
>>>>>>possible to do  some of it for known properties but I think it 
>>>>>>would be fragile.
>>>>>> 
>>>>>> For example:
>>>>>> 
>>>>>> var d:XML = a..child[0];
>>>>>> d.foo = <bar />;
>>>>>> 
>>>>>> In ActionScript you can get a change notification when foo is 
>>>>>>assigned.
>>>>>> With a bunch of work, if we know you are setting “foo” (which we 
>>>>>>do know  in this case) I think we could use Object.defineProperty 
>>>>>>to define a  property on d.
>>>>>> 
>>>>>> What we can’t easily do is:
>>>>>> 
>>>>>> var d:XML = a..child[0];
>>>>>> var s:String = “someRandomPropertyName”; d[s] = <bar />;
>>>>>> 
>>>>>> If we don’t know what ’s’ is, we can’t define properties early on 
>>>>>>the XML  node.  I suppose with even more code we could generate 
>>>>>>code for that.
>>>>>> 
>>>>>> BTW, for any sort of solution, we would have to know that “d” is 
>>>>>>XML and  not Object and that would require more careful type 
>>>>>>handling in the code  our customers write.  If you have:
>>>>>> 
>>>>>> 
>>>>>> public class MyClass extends EventDispatcher {  public var 
>>>>>> someProp:XML; }
>>>>>> 
>>>>>> Then in some other class you have:
>>>>>> 
>>>>>> var instance:MyClass = new MyClass(); 
>>>>>> instance.addEventListener(“someEvent”, myHandler);
>>>>>> 
>>>>>> function myHandler(event:Event):void {  event.target.someProp.foo 
>>>>>> = <newnode />; }
>>>>>> 
>>>>>> We have lost the notion that someProp is XML and not Object 
>>>>>>because  event.target is defined as Object and not MyClass.  Folks 
>>>>>>will have to fix  up their code to be:
>>>>>> 
>>>>>>  (event.target as MyClass).someProp.foo = <newnode />;
>>>>>> 
>>>>>> Which won’t be much fun and if you miss one, you won’t get a 
>>>>>>compile error.
>>>>>> 
>>>>>> FWIW, we could probably put in a warning if you forget () on 
>>>>>>“length”,  again if we know that length is being access on an XML 
>>>>>>node and not Object.
>>>>>> 
>>>>>> HTH,
>>>>>> -Alex
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>>
>>
>
>



Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Alex Harui <ah...@adobe.com>.
Thanks Jim,

We’ll keep that in mind.  Just curious, if FlexJS didn’t exist and you had
to use some other JS framework, would you port all of your XML handling to
JS or switch over to JSON?  Other folks with XML backend are welcome to
add their thoughts as well.

-Alex

On 11/10/15, 8:30 AM, "Jim Norris" <ji...@e-work.com> wrote:

>Hello,
>
>I have been observing the progress on FlexJS as I am the developer for an
>application built with Flex that my company deploys into large
>enterprises.
>
>We have XML based content and use a significant number of E4X
>expressions, so if there is a way to simplify the conversion of these
>expressions to Flex JS that would certainly make an eventual conversion
>of our application simpler.  We also use the XML.hasOwnProperty method to
>detect the existence of attributes that are used as configuration
>switches in the XML.
>
>
>
>
>Thanks,
>
>Jim Norris
>
>www.e-Work.com
>
>
>-----Original Message-----
>From: Alex Harui [mailto:aharui@adobe.com]
>Sent: Tuesday, November 10, 2015 11:07 AM
>To: dev@flex.apache.org
>Subject: Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)
>
>Also, don’t spend too long on trying to create an XML class in the
>default package.  You can just code it in some package and manually map
>it for now.  And maybe we’ll just end up having the compiler inject the
>mapping if that turns out to be easier.
>
>-Alex
>
>On 11/10/15, 6:18 AM, "Alex Harui" <ah...@adobe.com> wrote:
>
>>The key is in the build.xml and compile-asjs-config.xml in any of the
>>already-backported SWCs.  The js.swc from Falcon is used instead of
>>playerglobal.swc/airglobal.swc.  I have not tried to swap out a class
>>in the default package yet, but it should be doable.  We might need a
>>compiler change if there are assumptions.  And I have no idea if FB is
>>making any assumptions.
>>
>>I forgot to add to that wiki page how to deal with platform-only
>>components.  I will add that this morning, but basically, you should
>>add them to the as/src/XXXClasses.as and put COMPILE::JS or
>>COMPILE::AS3 around it.  There are examples, especially in the Core.swc
>>and HTML.swc.
>>
>>FWIW, I don’t know why you can’t go from XML to JSON and back to XML.
>>Both are hierarchical data structures.  In the Flex SDK we have
>>SOAPDecoder and SOAPEncoder that take XML to data objects and back, and
>>generally that performs better if you are going to access a significant
>>percentage of the data.
>>
>>HTH,
>>-Alex
>>
>>On 11/10/15, 3:45 AM, "Harbs" <ha...@gmail.com> wrote:
>>
>>>I’m a bit stumped here. We have externs for HTML and native javascript
>>>APIs. Right? How do I import these externs so these classes are
>>>recognized when using COMPILE::JS?
>>>
>>>Actually, I just searched for DOMParser and createHTMLDocument.
>>>Neither searched turned anything up in FlexJS. So I’m wondering if I
>>>was wrong about having externs for this.
>>>
>>>On Nov 10, 2015, at 10:48 AM, Harbs <ha...@gmail.com> wrote:
>>>
>>>> I’m going to have to do some fancy footwork to get this working.
>>>>Flash Builder is complaining that palyerglobal.swc already exists whe
>>>>I try to create an XML class in the default package.
>>>> 
>>>> Any ideas on how to do this?
>>>> 
>>>> On Nov 10, 2015, at 9:39 AM, Harbs <ha...@gmail.com> wrote:
>>>> 
>>>>> OK. This approach is different than the approach I started on, but
>>>>>it could be workable.
>>>>> 
>>>>> I was going down the road where there would be a set of single new
>>>>>classes which would proxy to XML and Document in Flash and HTML
>>>>>respectively. You are suggesting we stick with XML and XMLList for
>>>>>Flash and create new JS versions with the same public API as XML and
>>>>>XMLList.
>>>>> 
>>>>> Where would you go about creating those JS classes? Would I just
>>>>>out it in an “as” folder and wrap the whole class in a COMPILE::JS?
>>>>>Also, what package would this go into? I’m assuming none, since XML
>>>>>and XMLList are both top level classes.
>>>>> 
>>>>> BTW, I need to read and write XML files, so yeah, converting to
>>>>>JSON is not an option.
>>>>> 
>>>>> On Nov 10, 2015, at 1:28 AM, Alex Harui <ah...@adobe.com> wrote:
>>>>> 
>>>>>> Renaming the thread
>>>>>> 
>>>>>> On 11/9/15, 1:12 PM, "Harbs" <ha...@gmail.com> wrote:
>>>>>> 
>>>>>>> Well, I’d be interested in your findings.
>>>>>>> 
>>>>>>> If operator definitions is possible .. will be easier than .
>>>>>>>operators.
>>>>>>> If we allow single dot operators, it will be difficult to
>>>>>>>differentiate  between E4X syntax and function calls. I’d really
>>>>>>>like to drop the
>>>>>>>() on
>>>>>>> length and some of the other methods… Those are a course for very
>>>>>>>common  errors.
>>>>>> 
>>>>>> Maybe we aren’t talking about the same thing, but let me explain
>>>>>>in more  detail what I’m saying.
>>>>>> 
>>>>>> Here is some E4x:
>>>>>> 
>>>>>> var a:XML = new XML(\"<top attr1='cat'><child
>>>>>> attr2='dog'><grandchild
>>>>>> attr3='fish'>text</grandchild></child></top>\”);
>>>>>> var b:XMLList = a..child;
>>>>>> var c:XMLList = a..grandchild.(@attr2 == 'fish');
>>>>>> 
>>>>>> 
>>>>>> (It would be nice to have others add in their favorite or common
>>>>>>scenarios  if they are different).
>>>>>> 
>>>>>> The compiler already understands the “..” as well as the “@“.  The
>>>>>>way  Falcon and FalconJX works is that there is a parsing phase
>>>>>>that takes your  source code and creates a tree of different kinds
>>>>>>of nodes (ClassNodes,  FunctionNodes, FunctionCallNodes,
>>>>>>OperatorNodes,  MemberAccessExpressionNodes, etc).  Falcon then
>>>>>>walks the tree and  converts these nodes to ABC.  FalconJX walks
>>>>>>the tree and outputs  JavaScript.
>>>>>> 
>>>>>> I just ran a test and the above code was parsed into a tree where
>>>>>>the “..”
>>>>>> was the operator for a MemberAccessExpression. The “@“ was
>>>>>>converted into  a unary operator for an E4xFilter operator for
>>>>>>another  MemberAccessExpression.  This is good for FalconJX,
>>>>>>because that means we  understand the semantics of this syntax and
>>>>>>can then generate any  JavaScript we want.
>>>>>> 
>>>>>> IMO, given that folks are already wishing for a more Spark and
>>>>>>MX-like  component set, I think we should try to mimic as much of
>>>>>>E4x as possible  as opposed to inventing a new API that folks would
>>>>>>have to migrate to.
>>>>>> Performance-wise, I still think it would be worth everyone’s time
>>>>>>to  convert XML to JSON, but there are probably folks who can’t move.
>>>>>> 
>>>>>> Given that FlexJS leverages the concept of replacing abstractions,
>>>>>>if you  create an XML and XMLList class in JavaScript and populate
>>>>>>them with the  same APIs as ActionScript, lots of things should
>>>>>>work.  The FalconJX  compiler could easily be taught to convert
>>>>>>“a..child” into  “a.descendants()”.  If the JS version has an extra
>>>>>>filter() function, then  FalconJX would convert
>>>>>> 
>>>>>> a..grandchild.(@attr2 == 'fish’)
>>>>>> 
>>>>>> into
>>>>>> 
>>>>>> a.descendants().filter(function (node) { return
>>>>>> node.attribute(‘fish’).length() })
>>>>>> 
>>>>>> or something like that.
>>>>>> 
>>>>>> I think the part of XML in ActionScript that isn’t practical to do
>>>>>>in  JavaScript is handling change notifications.  It might be
>>>>>>possible to do  some of it for known properties but I think it
>>>>>>would be fragile.
>>>>>> 
>>>>>> For example:
>>>>>> 
>>>>>> var d:XML = a..child[0];
>>>>>> d.foo = <bar />;
>>>>>> 
>>>>>> In ActionScript you can get a change notification when foo is
>>>>>>assigned.
>>>>>> With a bunch of work, if we know you are setting “foo” (which we
>>>>>>do know  in this case) I think we could use Object.defineProperty
>>>>>>to define a  property on d.
>>>>>> 
>>>>>> What we can’t easily do is:
>>>>>> 
>>>>>> var d:XML = a..child[0];
>>>>>> var s:String = “someRandomPropertyName”; d[s] = <bar />;
>>>>>> 
>>>>>> If we don’t know what ’s’ is, we can’t define properties early on
>>>>>>the XML  node.  I suppose with even more code we could generate
>>>>>>code for that.
>>>>>> 
>>>>>> BTW, for any sort of solution, we would have to know that “d” is
>>>>>>XML and  not Object and that would require more careful type
>>>>>>handling in the code  our customers write.  If you have:
>>>>>> 
>>>>>> 
>>>>>> public class MyClass extends EventDispatcher {  public var
>>>>>> someProp:XML; }
>>>>>> 
>>>>>> Then in some other class you have:
>>>>>> 
>>>>>> var instance:MyClass = new MyClass();
>>>>>> instance.addEventListener(“someEvent”, myHandler);
>>>>>> 
>>>>>> function myHandler(event:Event):void {  event.target.someProp.foo
>>>>>> = <newnode />; }
>>>>>> 
>>>>>> We have lost the notion that someProp is XML and not Object
>>>>>>because  event.target is defined as Object and not MyClass.  Folks
>>>>>>will have to fix  up their code to be:
>>>>>> 
>>>>>>  (event.target as MyClass).someProp.foo = <newnode />;
>>>>>> 
>>>>>> Which won’t be much fun and if you miss one, you won’t get a
>>>>>>compile error.
>>>>>> 
>>>>>> FWIW, we could probably put in a warning if you forget () on
>>>>>>“length”,  again if we know that length is being access on an XML
>>>>>>node and not Object.
>>>>>> 
>>>>>> HTH,
>>>>>> -Alex
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>>
>>
>
>


RE: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Jim Norris <ji...@e-work.com>.
Hello,

I have been observing the progress on FlexJS as I am the developer for an application built with Flex that my company deploys into large enterprises.

We have XML based content and use a significant number of E4X expressions, so if there is a way to simplify the conversion of these expressions to Flex JS that would certainly make an eventual conversion of our application simpler.  We also use the XML.hasOwnProperty method to detect the existence of attributes that are used as configuration switches in the XML.




Thanks,

Jim Norris

www.e-Work.com


-----Original Message-----
From: Alex Harui [mailto:aharui@adobe.com] 
Sent: Tuesday, November 10, 2015 11:07 AM
To: dev@flex.apache.org
Subject: Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Also, don’t spend too long on trying to create an XML class in the default package.  You can just code it in some package and manually map it for now.  And maybe we’ll just end up having the compiler inject the mapping if that turns out to be easier.

-Alex

On 11/10/15, 6:18 AM, "Alex Harui" <ah...@adobe.com> wrote:

>The key is in the build.xml and compile-asjs-config.xml in any of the 
>already-backported SWCs.  The js.swc from Falcon is used instead of 
>playerglobal.swc/airglobal.swc.  I have not tried to swap out a class 
>in the default package yet, but it should be doable.  We might need a 
>compiler change if there are assumptions.  And I have no idea if FB is 
>making any assumptions.
>
>I forgot to add to that wiki page how to deal with platform-only 
>components.  I will add that this morning, but basically, you should 
>add them to the as/src/XXXClasses.as and put COMPILE::JS or 
>COMPILE::AS3 around it.  There are examples, especially in the Core.swc and HTML.swc.
>
>FWIW, I don’t know why you can’t go from XML to JSON and back to XML.
>Both are hierarchical data structures.  In the Flex SDK we have 
>SOAPDecoder and SOAPEncoder that take XML to data objects and back, and 
>generally that performs better if you are going to access a significant 
>percentage of the data.
>
>HTH,
>-Alex
>
>On 11/10/15, 3:45 AM, "Harbs" <ha...@gmail.com> wrote:
>
>>I’m a bit stumped here. We have externs for HTML and native javascript 
>>APIs. Right? How do I import these externs so these classes are 
>>recognized when using COMPILE::JS?
>>
>>Actually, I just searched for DOMParser and createHTMLDocument. 
>>Neither searched turned anything up in FlexJS. So I’m wondering if I 
>>was wrong about having externs for this.
>>
>>On Nov 10, 2015, at 10:48 AM, Harbs <ha...@gmail.com> wrote:
>>
>>> I’m going to have to do some fancy footwork to get this working. 
>>>Flash Builder is complaining that palyerglobal.swc already exists whe 
>>>I try to create an XML class in the default package.
>>> 
>>> Any ideas on how to do this?
>>> 
>>> On Nov 10, 2015, at 9:39 AM, Harbs <ha...@gmail.com> wrote:
>>> 
>>>> OK. This approach is different than the approach I started on, but 
>>>>it could be workable.
>>>> 
>>>> I was going down the road where there would be a set of single new 
>>>>classes which would proxy to XML and Document in Flash and HTML 
>>>>respectively. You are suggesting we stick with XML and XMLList for 
>>>>Flash and create new JS versions with the same public API as XML and 
>>>>XMLList.
>>>> 
>>>> Where would you go about creating those JS classes? Would I just 
>>>>out it in an “as” folder and wrap the whole class in a COMPILE::JS? 
>>>>Also, what package would this go into? I’m assuming none, since XML 
>>>>and XMLList are both top level classes.
>>>> 
>>>> BTW, I need to read and write XML files, so yeah, converting to 
>>>>JSON is not an option.
>>>> 
>>>> On Nov 10, 2015, at 1:28 AM, Alex Harui <ah...@adobe.com> wrote:
>>>> 
>>>>> Renaming the thread
>>>>> 
>>>>> On 11/9/15, 1:12 PM, "Harbs" <ha...@gmail.com> wrote:
>>>>> 
>>>>>> Well, I’d be interested in your findings.
>>>>>> 
>>>>>> If operator definitions is possible .. will be easier than .
>>>>>>operators.
>>>>>> If we allow single dot operators, it will be difficult to 
>>>>>>differentiate  between E4X syntax and function calls. I’d really 
>>>>>>like to drop the
>>>>>>() on
>>>>>> length and some of the other methods… Those are a course for very 
>>>>>>common  errors.
>>>>> 
>>>>> Maybe we aren’t talking about the same thing, but let me explain 
>>>>>in more  detail what I’m saying.
>>>>> 
>>>>> Here is some E4x:
>>>>> 
>>>>> var a:XML = new XML(\"<top attr1='cat'><child 
>>>>> attr2='dog'><grandchild 
>>>>> attr3='fish'>text</grandchild></child></top>\”);
>>>>> var b:XMLList = a..child;
>>>>> var c:XMLList = a..grandchild.(@attr2 == 'fish');
>>>>> 
>>>>> 
>>>>> (It would be nice to have others add in their favorite or common 
>>>>>scenarios  if they are different).
>>>>> 
>>>>> The compiler already understands the “..” as well as the “@“.  The 
>>>>>way  Falcon and FalconJX works is that there is a parsing phase 
>>>>>that takes your  source code and creates a tree of different kinds 
>>>>>of nodes (ClassNodes,  FunctionNodes, FunctionCallNodes, 
>>>>>OperatorNodes,  MemberAccessExpressionNodes, etc).  Falcon then 
>>>>>walks the tree and  converts these nodes to ABC.  FalconJX walks 
>>>>>the tree and outputs  JavaScript.
>>>>> 
>>>>> I just ran a test and the above code was parsed into a tree where 
>>>>>the “..”
>>>>> was the operator for a MemberAccessExpression. The “@“ was 
>>>>>converted into  a unary operator for an E4xFilter operator for 
>>>>>another  MemberAccessExpression.  This is good for FalconJX, 
>>>>>because that means we  understand the semantics of this syntax and 
>>>>>can then generate any  JavaScript we want.
>>>>> 
>>>>> IMO, given that folks are already wishing for a more Spark and 
>>>>>MX-like  component set, I think we should try to mimic as much of 
>>>>>E4x as possible  as opposed to inventing a new API that folks would 
>>>>>have to migrate to.
>>>>> Performance-wise, I still think it would be worth everyone’s time 
>>>>>to  convert XML to JSON, but there are probably folks who can’t move.
>>>>> 
>>>>> Given that FlexJS leverages the concept of replacing abstractions, 
>>>>>if you  create an XML and XMLList class in JavaScript and populate 
>>>>>them with the  same APIs as ActionScript, lots of things should 
>>>>>work.  The FalconJX  compiler could easily be taught to convert 
>>>>>“a..child” into  “a.descendants()”.  If the JS version has an extra 
>>>>>filter() function, then  FalconJX would convert
>>>>> 
>>>>> a..grandchild.(@attr2 == 'fish’)
>>>>> 
>>>>> into
>>>>> 
>>>>> a.descendants().filter(function (node) { return
>>>>> node.attribute(‘fish’).length() })
>>>>> 
>>>>> or something like that.
>>>>> 
>>>>> I think the part of XML in ActionScript that isn’t practical to do 
>>>>>in  JavaScript is handling change notifications.  It might be 
>>>>>possible to do  some of it for known properties but I think it 
>>>>>would be fragile.
>>>>> 
>>>>> For example:
>>>>> 
>>>>> var d:XML = a..child[0];
>>>>> d.foo = <bar />;
>>>>> 
>>>>> In ActionScript you can get a change notification when foo is 
>>>>>assigned.
>>>>> With a bunch of work, if we know you are setting “foo” (which we 
>>>>>do know  in this case) I think we could use Object.defineProperty 
>>>>>to define a  property on d.
>>>>> 
>>>>> What we can’t easily do is:
>>>>> 
>>>>> var d:XML = a..child[0];
>>>>> var s:String = “someRandomPropertyName”; d[s] = <bar />;
>>>>> 
>>>>> If we don’t know what ’s’ is, we can’t define properties early on 
>>>>>the XML  node.  I suppose with even more code we could generate 
>>>>>code for that.
>>>>> 
>>>>> BTW, for any sort of solution, we would have to know that “d” is 
>>>>>XML and  not Object and that would require more careful type 
>>>>>handling in the code  our customers write.  If you have:
>>>>> 
>>>>> 
>>>>> public class MyClass extends EventDispatcher {  public var 
>>>>> someProp:XML; }
>>>>> 
>>>>> Then in some other class you have:
>>>>> 
>>>>> var instance:MyClass = new MyClass(); 
>>>>> instance.addEventListener(“someEvent”, myHandler);
>>>>> 
>>>>> function myHandler(event:Event):void {  event.target.someProp.foo 
>>>>> = <newnode />; }
>>>>> 
>>>>> We have lost the notion that someProp is XML and not Object 
>>>>>because  event.target is defined as Object and not MyClass.  Folks 
>>>>>will have to fix  up their code to be:
>>>>> 
>>>>>  (event.target as MyClass).someProp.foo = <newnode />;
>>>>> 
>>>>> Which won’t be much fun and if you miss one, you won’t get a 
>>>>>compile error.
>>>>> 
>>>>> FWIW, we could probably put in a warning if you forget () on 
>>>>>“length”,  again if we know that length is being access on an XML 
>>>>>node and not Object.
>>>>> 
>>>>> HTH,
>>>>> -Alex
>>>>> 
>>>>> 
>>>> 
>>> 
>>
>



Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Alex Harui <ah...@adobe.com>.
Also, don’t spend too long on trying to create an XML class in the default
package.  You can just code it in some package and manually map it for
now.  And maybe we’ll just end up having the compiler inject the mapping
if that turns out to be easier.

-Alex

On 11/10/15, 6:18 AM, "Alex Harui" <ah...@adobe.com> wrote:

>The key is in the build.xml and compile-asjs-config.xml in any of the
>already-backported SWCs.  The js.swc from Falcon is used instead of
>playerglobal.swc/airglobal.swc.  I have not tried to swap out a class in
>the default package yet, but it should be doable.  We might need a
>compiler change if there are assumptions.  And I have no idea if FB is
>making any assumptions.
>
>I forgot to add to that wiki page how to deal with platform-only
>components.  I will add that this morning, but basically, you should add
>them to the as/src/XXXClasses.as and put COMPILE::JS or COMPILE::AS3
>around it.  There are examples, especially in the Core.swc and HTML.swc.
>
>FWIW, I don’t know why you can’t go from XML to JSON and back to XML.
>Both are hierarchical data structures.  In the Flex SDK we have
>SOAPDecoder and SOAPEncoder that take XML to data objects and back, and
>generally that performs better if you are going to access a significant
>percentage of the data.
>
>HTH,
>-Alex
>
>On 11/10/15, 3:45 AM, "Harbs" <ha...@gmail.com> wrote:
>
>>I’m a bit stumped here. We have externs for HTML and native javascript
>>APIs. Right? How do I import these externs so these classes are
>>recognized when using COMPILE::JS?
>>
>>Actually, I just searched for DOMParser and createHTMLDocument. Neither
>>searched turned anything up in FlexJS. So I’m wondering if I was wrong
>>about having externs for this.
>>
>>On Nov 10, 2015, at 10:48 AM, Harbs <ha...@gmail.com> wrote:
>>
>>> I’m going to have to do some fancy footwork to get this working. Flash
>>>Builder is complaining that palyerglobal.swc already exists whe I try to
>>>create an XML class in the default package.
>>> 
>>> Any ideas on how to do this?
>>> 
>>> On Nov 10, 2015, at 9:39 AM, Harbs <ha...@gmail.com> wrote:
>>> 
>>>> OK. This approach is different than the approach I started on, but it
>>>>could be workable.
>>>> 
>>>> I was going down the road where there would be a set of single new
>>>>classes which would proxy to XML and Document in Flash and HTML
>>>>respectively. You are suggesting we stick with XML and XMLList for
>>>>Flash and create new JS versions with the same public API as XML and
>>>>XMLList.
>>>> 
>>>> Where would you go about creating those JS classes? Would I just out
>>>>it in an “as” folder and wrap the whole class in a COMPILE::JS? Also,
>>>>what package would this go into? I’m assuming none, since XML and
>>>>XMLList are both top level classes.
>>>> 
>>>> BTW, I need to read and write XML files, so yeah, converting to JSON
>>>>is not an option.
>>>> 
>>>> On Nov 10, 2015, at 1:28 AM, Alex Harui <ah...@adobe.com> wrote:
>>>> 
>>>>> Renaming the thread
>>>>> 
>>>>> On 11/9/15, 1:12 PM, "Harbs" <ha...@gmail.com> wrote:
>>>>> 
>>>>>> Well, I’d be interested in your findings.
>>>>>> 
>>>>>> If operator definitions is possible .. will be easier than .
>>>>>>operators.
>>>>>> If we allow single dot operators, it will be difficult to
>>>>>>differentiate
>>>>>> between E4X syntax and function calls. I’d really like to drop the
>>>>>>() on
>>>>>> length and some of the other methods… Those are a course for very
>>>>>>common
>>>>>> errors.
>>>>> 
>>>>> Maybe we aren’t talking about the same thing, but let me explain in
>>>>>more
>>>>> detail what I’m saying.
>>>>> 
>>>>> Here is some E4x:
>>>>> 
>>>>> var a:XML = new XML(\"<top attr1='cat'><child attr2='dog'><grandchild
>>>>> attr3='fish'>text</grandchild></child></top>\”);
>>>>> var b:XMLList = a..child;
>>>>> var c:XMLList = a..grandchild.(@attr2 == 'fish');
>>>>> 
>>>>> 
>>>>> (It would be nice to have others add in their favorite or common
>>>>>scenarios
>>>>> if they are different).
>>>>> 
>>>>> The compiler already understands the “..” as well as the “@“.  The
>>>>>way
>>>>> Falcon and FalconJX works is that there is a parsing phase that takes
>>>>>your
>>>>> source code and creates a tree of different kinds of nodes
>>>>>(ClassNodes,
>>>>> FunctionNodes, FunctionCallNodes, OperatorNodes,
>>>>> MemberAccessExpressionNodes, etc).  Falcon then walks the tree and
>>>>> converts these nodes to ABC.  FalconJX walks the tree and outputs
>>>>> JavaScript.
>>>>> 
>>>>> I just ran a test and the above code was parsed into a tree where the
>>>>>“..”
>>>>> was the operator for a MemberAccessExpression. The “@“ was converted
>>>>>into
>>>>> a unary operator for an E4xFilter operator for another
>>>>> MemberAccessExpression.  This is good for FalconJX, because that
>>>>>means we
>>>>> understand the semantics of this syntax and can then generate any
>>>>> JavaScript we want.
>>>>> 
>>>>> IMO, given that folks are already wishing for a more Spark and
>>>>>MX-like
>>>>> component set, I think we should try to mimic as much of E4x as
>>>>>possible
>>>>> as opposed to inventing a new API that folks would have to migrate
>>>>>to.
>>>>> Performance-wise, I still think it would be worth everyone’s time to
>>>>> convert XML to JSON, but there are probably folks who can’t move.
>>>>> 
>>>>> Given that FlexJS leverages the concept of replacing abstractions, if
>>>>>you
>>>>> create an XML and XMLList class in JavaScript and populate them with
>>>>>the
>>>>> same APIs as ActionScript, lots of things should work.  The FalconJX
>>>>> compiler could easily be taught to convert “a..child” into
>>>>> “a.descendants()”.  If the JS version has an extra filter() function,
>>>>>then
>>>>> FalconJX would convert
>>>>> 
>>>>> a..grandchild.(@attr2 == 'fish’)
>>>>> 
>>>>> into 
>>>>> 
>>>>> a.descendants().filter(function (node) { return
>>>>> node.attribute(‘fish’).length() })
>>>>> 
>>>>> or something like that.
>>>>> 
>>>>> I think the part of XML in ActionScript that isn’t practical to do in
>>>>> JavaScript is handling change notifications.  It might be possible to
>>>>>do
>>>>> some of it for known properties but I think it would be fragile.
>>>>> 
>>>>> For example:
>>>>> 
>>>>> var d:XML = a..child[0];
>>>>> d.foo = <bar />;
>>>>> 
>>>>> In ActionScript you can get a change notification when foo is
>>>>>assigned.
>>>>> With a bunch of work, if we know you are setting “foo” (which we do
>>>>>know
>>>>> in this case) I think we could use Object.defineProperty to define a
>>>>> property on d.
>>>>> 
>>>>> What we can’t easily do is:
>>>>> 
>>>>> var d:XML = a..child[0];
>>>>> var s:String = “someRandomPropertyName”;
>>>>> d[s] = <bar />;
>>>>> 
>>>>> If we don’t know what ’s’ is, we can’t define properties early on the
>>>>>XML
>>>>> node.  I suppose with even more code we could generate code for that.
>>>>> 
>>>>> BTW, for any sort of solution, we would have to know that “d” is XML
>>>>>and
>>>>> not Object and that would require more careful type handling in the
>>>>>code
>>>>> our customers write.  If you have:
>>>>> 
>>>>> 
>>>>> public class MyClass extends EventDispatcher
>>>>> {
>>>>>  public var someProp:XML;
>>>>> }
>>>>> 
>>>>> Then in some other class you have:
>>>>> 
>>>>> var instance:MyClass = new MyClass();
>>>>> instance.addEventListener(“someEvent”, myHandler);
>>>>> 
>>>>> function myHandler(event:Event):void
>>>>> {
>>>>>  event.target.someProp.foo = <newnode />;
>>>>> }
>>>>> 
>>>>> We have lost the notion that someProp is XML and not Object because
>>>>> event.target is defined as Object and not MyClass.  Folks will have
>>>>>to fix
>>>>> up their code to be:
>>>>> 
>>>>>  (event.target as MyClass).someProp.foo = <newnode />;
>>>>> 
>>>>> Which won’t be much fun and if you miss one, you won’t get a compile
>>>>>error.
>>>>> 
>>>>> FWIW, we could probably put in a warning if you forget () on
>>>>>“length”,
>>>>> again if we know that length is being access on an XML node and not
>>>>>Object.
>>>>> 
>>>>> HTH,
>>>>> -Alex
>>>>> 
>>>>> 
>>>> 
>>> 
>>
>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 11/15/15, 8:49 AM, "Harbs" <ha...@gmail.com> wrote:

>BTW, how are we handling “for each” loops?

If you do defineProperties as I just described in my last post, I think
for each will “just work”.  You will have to hide from enumeration the
functions like name(), child(), etc.

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
BTW, how are we handling “for each” loops?

On Nov 12, 2015, at 11:43 PM, Alex Harui <ah...@adobe.com> wrote:

> OK, it’s a deal.  I will look into some changes to the compiler.
> 
> I think the changes are:
> 1) XML literals will call "new XML(literal_as_string)" and your code will
> parse the string
> 2) delete on XMLList will call _as3_removeChild() but delete on XML just
> does delete
> 3) all function calls on XML and XMLList will be prepended with “_as3_”
> 4) .. will result in calls to _as3_descendants()
> 5) @ will result in a call to _as3_attribute()
> 6) filters (@attr == “bar”) results in a call to
> _as3_filter(Function(node:XML):Boolean)
> 
> Can we put of #6 for a while?  Did I leave anything out?
> 
> -Alex
> 
> On 11/12/15, 1:34 PM, "Harbs" <ha...@gmail.com> wrote:
> 
>> Prepending a decoration might work. I’d probably pick something like
>> “_as3_” rather than “AS3” for the reason that it looks more like a
>> prepend to the name and it makes the unlikely chance that someone has an
>> element with the prepended namespace even more unlikely.
>> 
>> defineProperty with one extra index might work. I’ll give that a go…
>> 
>> On Nov 12, 2015, at 11:18 PM, Alex Harui <ah...@adobe.com> wrote:
>> 
>>> 
>>> 
>>> On 11/12/15, 12:48 PM, "Harbs" <ha...@gmail.com> wrote:
>>> 
>>>> What I mean was that the dynamic object structure could be a property
>>>> of
>>>> XML rather than being XML itself.
>>>> 
>>>> So the API would be XML which would have all the necessary functions,
>>>> but
>>>> it would keep a living structure as a separate dynamic object.
>>>> 
>>>> If the compiler could modify all delete operator calls on XML
>>>> properties
>>>> to the corresponding dynamic object within, that might solve this
>>>> issue.
>>> 
>>> I’m worried that proxy-ing properties to an internal object will result
>>> in
>>> performance problems, bloat the code, make it harder to debug on the JS
>>> side (should you need to).  Having properties on the XML instance itself
>>> would probably let code run correctly where we didn’t know it was XML
>>> (and
>>> thought it was Object).
>>> 
>>> I just noticed that in Flash, the XML methods are in the AS3 namespace,
>>> which is why they don’t collide with the child “name” tag.  I think it
>>> might be easier to catch that the function call resolved to that
>>> namespace
>>> and prepend a decoration on the function name.
>>> 
>>> Then you would write your XML class as:
>>> 
>>> public class XML()
>>> {
>>>  public function AS3name():XMLList
>>>  {
>>>   ..
>>>  }
>>> }
>>> 
>>>> 
>>>> Regarding #2: Yes. It’s probably possible to substitute writing to
>>>> XMLList to modifying XML instead, changing XMLList is VERY common, and
>>>> if
>>>> we’re trying to accommodate existing code, there’s going to be lots of
>>>> bad code. It’s also almost always easier to write to XMLList than it is
>>>> to XML. Another part of the problem is that I think a lot of folks
>>>> don’t
>>>> have the distinction between XMLList and XML clear in certai use cases.
>>>> This is especially true because single item XMLLists almost always
>>>> behave
>>>> as if they are XML objects.
>>> 
>>> Well, if you find the defineProperties trick acceptable, I think it
>>> would
>>> work in most of these cases.
>>> 
>>> Thoughts?
>>> -Alex
>>> 
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 1/5/16, 7:07 AM, "Harbs" <ha...@gmail.com> wrote:

>Yes. I’m using DOMParser.parseFromString() to parse the XML. After the
>XML is parsed into DOM elements, I’m walking that to create the XML
>structure.
>
>Although, I’m beginning to wonder if it makes more sense to just write my
>own state machine to walk the XML and build the structure on my own.

DOMParser.parseFromString requires IE10 or later.  Which isn't a deal
breaker, but we'll have to make sure folks are aware.  I haven't looked to
see if there is a polyfill for IE9 (our current baseline) but I would
recommend not writing your own parser.  I'd rather you spend that time one
something else.

What does Flash do for toXMLString() for CDATA and text that requires
escaping?  What does the E4x spec say?

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 2/9/16, 12:55 PM, "Harbs" <ha...@gmail.com> wrote:

>> Are you
>> implementing XMLList as an Array or dynamic class with numeric property
>> names?
>
>I am using Object.defineProperty to assign the numeric property names.
>There’s always length+1 numeric properties assigned.
>
>I was planning on adding a “0" property to XML as well.

OK.  If that becomes painful, we could try to call a get() method instead.

>
>> I don't think this is the same.  The spec says resolveValue is added so
>>it
>> is functionality unique to XML and XMLList handling.  valueOf is used by
>> the runtime in other places.  It looks like resolveValue is only used
>>in a
>> few specific cases.  It might have to be completely handled in the AS
>> implementation.  I don't know if the compiler needs to do anything.  It
>> looks like if you have some XML like:
>> 
>>    var xml:XML = <node><child /></node>
>> 
>> Then do:
>> 
>>    var myChild:XMLList = xml.myChild;
>> 
>> then myChild will be assigned an empty XMLList since there is no myChild
>> tag in xml.  But amazingly, if you then do:
>> 
>>    myChild[0] = foo;
>> 
>> The implementation is supposed to use resolveValue to add a myChild
>> property to the xml so the net is:
>> 
>>   <node><child /><myChild>foo</myChild></node>
>
>Right. Every XMLList returned by public methods of XML has a targetObject
>object which refers to “this” and when the XMLList is altered, that’s
>supposed to be modified. (I have not done this bit yet.) I’m not sure why
>I need resolveValue for this.

Not sure either.  I think it gives the XMLList a chance to create the
property on the targetObject XML.

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
> Are you
> implementing XMLList as an Array or dynamic class with numeric property
> names?

I am using Object.defineProperty to assign the numeric property names. There’s always length+1 numeric properties assigned.

I was planning on adding a “0" property to XML as well.

> I don't think this is the same.  The spec says resolveValue is added so it
> is functionality unique to XML and XMLList handling.  valueOf is used by
> the runtime in other places.  It looks like resolveValue is only used in a
> few specific cases.  It might have to be completely handled in the AS
> implementation.  I don't know if the compiler needs to do anything.  It
> looks like if you have some XML like:
> 
>    var xml:XML = <node><child /></node>
> 
> Then do:
> 
>    var myChild:XMLList = xml.myChild;
> 
> then myChild will be assigned an empty XMLList since there is no myChild
> tag in xml.  But amazingly, if you then do:
> 
>    myChild[0] = foo;
> 
> The implementation is supposed to use resolveValue to add a myChild
> property to the xml so the net is:
> 
>   <node><child /><myChild>foo</myChild></node>

Right. Every XMLList returned by public methods of XML has a targetObject object which refers to “this” and when the XMLList is altered, that’s supposed to be modified. (I have not done this bit yet.) I’m not sure why I need resolveValue for this.

On Feb 9, 2016, at 8:04 PM, Alex Harui <ah...@adobe.com> wrote:

> 
> 
> On 2/9/16, 1:39 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> Thanks for this. It’s really good to have someone else go through this
>> and give me a sanity check. Most of this is very much in line with what
>> I’ve already done.
>> 
>> Some comments:
>> 
>>> [[get]]
>> someXML[x] is only valid when x is 0 and that returns someXML and not a
>> child of someXML.
> 
> OK, I hadn't realized that.  That makes me wonder if we need to intercept
> all bracket calls on XML and XMLList and call child(int).  Are you
> implementing XMLList as an Array or dynamic class with numeric property
> names?  It might be better to implement a get() method and have the
> compiler call that with ints or property names.  Apparently we are
> supposed to blur the distinction between XML and XMLList.  I suppose
> another trick would be to create a "0" property on XML.
> 
>> 
>>> [[defaultValue]]
>> I’m not even sure what this means. I’ve implemented valueOf() and
>> toString(). I’m not clear on when [[defaultValue]] is used.
> 
> I think it is used in automatic type conversion.  See [1].  Maybe you can
> just implement valueOf() to call toString().
> 
>> 
>>> [[hasProperty]]
>> I implemented hasOwnProperty() I’m not sure we need to do anything else.
> 
> OK. Makes sense.
> 
>> 
>>> [[deepCopy]]
>> Yes. AFAICT, copy() is the the same as [[deepCopy]]
> 
> Agreed.
> 
>> 
>>> [[resolveValue]]
>> Ditto. I implemented valueOf(). Not sure if it’s the same.
> 
> I don't think this is the same.  The spec says resolveValue is added so it
> is functionality unique to XML and XMLList handling.  valueOf is used by
> the runtime in other places.  It looks like resolveValue is only used in a
> few specific cases.  It might have to be completely handled in the AS
> implementation.  I don't know if the compiler needs to do anything.  It
> looks like if you have some XML like:
> 
>    var xml:XML = <node><child /></node>
> 
> Then do:
> 
>    var myChild:XMLList = xml.myChild;
> 
> then myChild will be assigned an empty XMLList since there is no myChild
> tag in xml.  But amazingly, if you then do:
> 
>    myChild[0] = foo;
> 
> The implementation is supposed to use resolveValue to add a myChild
> property to the xml so the net is:
> 
>   <node><child /><myChild>foo</myChild></node>
> 
>> 
>>> [[append]] maps to concat()
>> That’s for XMLList. (which I’ve already done) What do we do for XML? Not
>> implement it? throw an error?
> 
> If I understand the spec, it never gets called on XML.  When the compiler
> sees the "+" operator, the generated code is supposed to generate a new
> XMLList.
> 
> Thanks for working on the E4X. It will be pretty cool when it starts
> working.
> 
> -Alex
> 
> [1] 
> http://www.i-programmer.info/programming/javascript/2951-objects-with-value
> s.html
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
I’m working on toXMLString, and I need to write new lines. Is there a recommended way of writing new lines in a platform agnostic manner?

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 2/10/16, 3:23 AM, "Harbs" <ha...@gmail.com> wrote:

>I missed an issue here:
>
>Taking an example from the spec:
>e.employee.(name == "Jim").setChildren(<name>John</name> + <age>35</age>);
>
>or:
>var employeedata = <name>Fred</name> + <age>28</age> +
><hobby>skiing</hobby>;
>
>We need a method to concatenate two or more XML objects into an XML
>object. I see two ways to do this:
>
>1. Add a concat method to XML which returns a new XMLList with the XML
>object and the value passed in. If we do this, the compiler will not need
>to differentiate between XML and XMLList. Either one can be on either
>side of the operator.
>2. The compiler will need to create an XMLList for any XML object used.
>
>It seems to me that option #1 is simpler and less error prone.

You are probably right, but the spec says that the runtime (and therefore
our compiler) should generate an empty XMLList when an expression only
contains XML objects.  I have a feeling that before we're done, we'll be
needing the compiler to do some other stuff related to automatic type
conversion.  Otherwise, I think you will need to have the implementation
check the type various things at runtime to see if they are XML or
XMLList.  In theory the compiler already knows.

-Alex

>
>On Feb 9, 2016, at 8:04 PM, Alex Harui <ah...@adobe.com> wrote:
>
>>>> [[append]] maps to concat()
>>> That’s for XMLList. (which I’ve already done) What do we do for XML?
>>>Not
>>> implement it? throw an error?
>> 
>> If I understand the spec, it never gets called on XML.  When the
>>compiler
>> sees the "+" operator, the generated code is supposed to generate a new
>> XMLList.
>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
I missed an issue here:

Taking an example from the spec:
e.employee.(name == "Jim").setChildren(<name>John</name> + <age>35</age>);

or:
var employeedata = <name>Fred</name> + <age>28</age> + <hobby>skiing</hobby>;

We need a method to concatenate two or more XML objects into an XML object. I see two ways to do this:

1. Add a concat method to XML which returns a new XMLList with the XML object and the value passed in. If we do this, the compiler will not need to differentiate between XML and XMLList. Either one can be on either side of the operator.
2. The compiler will need to create an XMLList for any XML object used.

It seems to me that option #1 is simpler and less error prone.

On Feb 9, 2016, at 8:04 PM, Alex Harui <ah...@adobe.com> wrote:

>>> [[append]] maps to concat()
>> That’s for XMLList. (which I’ve already done) What do we do for XML? Not
>> implement it? throw an error?
> 
> If I understand the spec, it never gets called on XML.  When the compiler
> sees the "+" operator, the generated code is supposed to generate a new
> XMLList.


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 2/9/16, 1:39 AM, "Harbs" <ha...@gmail.com> wrote:

>Thanks for this. It’s really good to have someone else go through this
>and give me a sanity check. Most of this is very much in line with what
>I’ve already done.
>
>Some comments:
>
>> [[get]]
>someXML[x] is only valid when x is 0 and that returns someXML and not a
>child of someXML.

OK, I hadn't realized that.  That makes me wonder if we need to intercept
all bracket calls on XML and XMLList and call child(int).  Are you
implementing XMLList as an Array or dynamic class with numeric property
names?  It might be better to implement a get() method and have the
compiler call that with ints or property names.  Apparently we are
supposed to blur the distinction between XML and XMLList.  I suppose
another trick would be to create a "0" property on XML.

>
>> [[defaultValue]]
>I’m not even sure what this means. I’ve implemented valueOf() and
>toString(). I’m not clear on when [[defaultValue]] is used.

I think it is used in automatic type conversion.  See [1].  Maybe you can
just implement valueOf() to call toString().

>
>> [[hasProperty]]
>I implemented hasOwnProperty() I’m not sure we need to do anything else.

OK. Makes sense.

>
>> [[deepCopy]]
>Yes. AFAICT, copy() is the the same as [[deepCopy]]

Agreed.

>
>> [[resolveValue]]
>Ditto. I implemented valueOf(). Not sure if it’s the same.

I don't think this is the same.  The spec says resolveValue is added so it
is functionality unique to XML and XMLList handling.  valueOf is used by
the runtime in other places.  It looks like resolveValue is only used in a
few specific cases.  It might have to be completely handled in the AS
implementation.  I don't know if the compiler needs to do anything.  It
looks like if you have some XML like:

    var xml:XML = <node><child /></node>

Then do:

    var myChild:XMLList = xml.myChild;

then myChild will be assigned an empty XMLList since there is no myChild
tag in xml.  But amazingly, if you then do:

    myChild[0] = foo;

The implementation is supposed to use resolveValue to add a myChild
property to the xml so the net is:

   <node><child /><myChild>foo</myChild></node>

>
>> [[append]] maps to concat()
>That’s for XMLList. (which I’ve already done) What do we do for XML? Not
>implement it? throw an error?

If I understand the spec, it never gets called on XML.  When the compiler
sees the "+" operator, the generated code is supposed to generate a new
XMLList.

Thanks for working on the E4X. It will be pretty cool when it starts
working.

-Alex

[1] 
http://www.i-programmer.info/programming/javascript/2951-objects-with-value
s.html


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Thanks for this. It’s really good to have someone else go through this and give me a sanity check. Most of this is very much in line with what I’ve already done.

Some comments:

> [[get]]
someXML[x] is only valid when x is 0 and that returns someXML and not a child of someXML.

> [[put]]
Yes.

> [[delete]]
Yes.

> [[deleteByIndex]]
Probably. I think I’m using an alternate “remove by index” method internally, but I’ll probably name it something else to avoid issues.

> [[defaultValue]]
I’m not even sure what this means. I’ve implemented valueOf() and toString(). I’m not clear on when [[defaultValue]] is used.

> [[hasProperty]]
I implemented hasOwnProperty() I’m not sure we need to do anything else.

> [[deepCopy]]
Yes. AFAICT, copy() is the the same as [[deepCopy]]

> [[descendants]]
Yes.

> [[equals]]
Yes.

> [[resolveValue]]
Ditto. I implemented valueOf(). Not sure if it’s the same.

> [[insert]]
Yes.

> [[replace]]
Yes.

> [[addInScopeNamespaces]]
Yes.

> [[append]] maps to concat()
That’s for XMLList. (which I’ve already done) What do we do for XML? Not implement it? throw an error?

On Feb 9, 2016, at 2:56 AM, Alex Harui <ah...@adobe.com> wrote:

> OK, I looked at what is coded up so far on the compiler side and looked at
> the spec some more.  We've taken the approach so far of making up public
> method names that have a pretty close mapping to the internal methods.  It
> seems to me that we should not try to obfuscate the method names.  So what
> if there is a setChild() or filter() method on our JS version of XML.
> 
> One notable difference in the mapping is that the compiler has already
> parsed the @ prefix for attributes into its own token, so it makes it
> easier to call setAttribute() vs setChild() so the internal implementation
> doesn't have to bother to determine what is being "put".
> 
> Here's what I came up with:
> 
> [[get]] maps to attribute() and child() methods.  I think we need to
> handle someXML[x] where x is a numeric property name (0, 1, 2, 3, etc).
> We could see if we know the key is an integer and output elements()[x].
> 
> [[put]] maps to setAttribute() and setChild() methods.  The setAttribute()
> and setChild() implementations should call [[deepCopy]] on the value.  I
> don't think the compiler should call [[deepCopy]].
> 
> [[delete]] maps to removeChild().
> 
> [[deleteByIndex]] maps to removeChildAt() methods.  The implementation
> probably needs to throw the TypeError if removeChildAt() is called on an
> XML object.  For now, I think you'll get an NPE if there isn't a
> removeChildAt() on XML.
> 
> [[defaultValue]] This is not currently implemented in the compiler.  We
> should probably take this on when we get around to handling other
> ActionScript automatic type conversions.
> 
> [[hasProperty]] This is not currently implemented in the compiler.
> 
> [[deepCopy]] I think the compiler doesn't need to do anything here and the
> implementation will handle it.
> 
> [[descendants]] The compiler is mapping ".." to descendants() calls.
> 
> [[equals]] The compiler will have to look for "==" and call and equals()
> method.
> 
> [[resolveValue]] I'm not quite sure what to do here.
> 
> [[insert]] I think the compiler doesn't need to do anything here and the
> implementation will handle it.
> 
> [[replace]] I think the compiler doesn't need to do anything here and the
> implementation will handle it.
> 
> [[addInScopeNamespaces]] I think the compiler doesn't need to do anything
> here and the implementation will handle it.
> 
> [[append]] maps to concat()
> 
> 
> Another area of work is handling things like:
> 
> -typeof
> 
> -instanceof
> 
> These are already caught and converted to calls to
> org.apache.flex.utils.Language.  I think the Language implementation will
> have to become smart about XML.
> 
> Thoughts?
> -Alex
> 
> 
> On 2/8/16, 8:30 AM, "Alex Harui" <ah...@adobe.com> wrote:
> 
>> 
>> 
>> On 2/8/16, 1:00 AM, "Harbs" <ha...@gmail.com> wrote:
>>> However the spec does not specify bracket notation internally, so that’s
>>> not very clear. It could just be I’m not very experienced at reading
>>> specification documentation… ;-)
>> 
>> I'm not good at reading specs, probably because I find it boring.  This
>> spec [1] seems to describe some not-so-common notation like the double
>> brackets in section 9.1.1.
>> 
>> [1] 
>> http://www.ecma-international.org/publications/files/ECMA-ST-WITHDRAWN/Ecm
>> a
>> -357.pdf
>> 
>> 
>>> 
>>> I have implemented some of the internal methods/properties, but not all.
>>> I’m not sure it makes sense to implement them all.
>> 
>> Implementing the internal methods/properties does not seem to be required
>> by the spec.  But which ones are you thinking of skipping?
>> 
>>> 
>>> It could be it makes sense to modify things a bit, but right now my
>>> priority is to get all this working. Apparently, some feel that the ECMA
>>> spec has some problems with it which might have been patched[1], but I’m
>>> not sure exactly which.
>> 
>> There could certainly be bugs everywhere: in the spec, in the Flash
>> implementation, in the Mozilla implementation which apparently isn't
>> available anymore.
>> 
>>> 
>>> Right now, I’m pretty close to having all the methods in place (after
>>> quite a few rewrites). The only thing I have not even started on is
>>> filtering. I have no actually tried to compile any of this, so that will
>>> be a whole task in itself. (BTW, you can see what I currently have done
>>> in the e4x branch.)
>> 
>> I have not looked closely at what you committed, but I'm quite excited
>> that you are making any sort of progress on this.
>> 
>>> 
>>> So here’s my current plan:
>>> 1. Finish up the methods (minus filtering) in the next day or two.
>>> 2. Sync up XML with the current FlexJS folder structure and get rid of
>>> some junk (like all the JXON classes).
>>> 3. Get this all to compile.
>>> 4. Figure out the whole filtering issue.
>>> 5. Create test cases.
>>> 
>>> Once this is done (or mostly done), it probably makes sense to get a
>>> sanity check and decide whether to rewrite some of what I’ve done.
>>> 
>>> Makes sense?
>> 
>> Sounds reasonable.  I spent more time skimming the spec this morning.  I
>> think there are a lot more cases that the compiler doesn't handle.  You
>> and I may need to coordinate on when to work on those things, not that I'm
>> looking forward to having to do all that work.  The key to success looks
>> like it will be how the compiler can or can't know the resolved type of
>> something.  The spec is about how to change the runtime, but we can't
>> change the runtime and need to detect when an object is XML and generate
>> different code.  I have some concerns about whether that will start to
>> affect compiler performance, but I guess we'll just have to see, or maybe
>> I'll put XML checking in some conditional so you can opt in.
>> 
>> The link you posted didn't seem to point to any particular bug in E4X, but
>> it was an interesting discussion in how the JS runtimes don't want to take
>> on the complexity of E4X.  It would be interesting if there is a
>> functional subset of E4X that we could implement that would draw in the
>> E4X folks, especially the Node folks that appear to be stuck with handling
>> XML documents for legacy support reasons.
>> 
>>> 
>>> [1]https://bugs.chromium.org/p/v8/issues/detail?id=235#c75
>> 
>> -Alex
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Alex Harui <ah...@adobe.com>.
OK, I looked at what is coded up so far on the compiler side and looked at
the spec some more.  We've taken the approach so far of making up public
method names that have a pretty close mapping to the internal methods.  It
seems to me that we should not try to obfuscate the method names.  So what
if there is a setChild() or filter() method on our JS version of XML.

One notable difference in the mapping is that the compiler has already
parsed the @ prefix for attributes into its own token, so it makes it
easier to call setAttribute() vs setChild() so the internal implementation
doesn't have to bother to determine what is being "put".

Here's what I came up with:

[[get]] maps to attribute() and child() methods.  I think we need to
handle someXML[x] where x is a numeric property name (0, 1, 2, 3, etc).
We could see if we know the key is an integer and output elements()[x].

[[put]] maps to setAttribute() and setChild() methods.  The setAttribute()
and setChild() implementations should call [[deepCopy]] on the value.  I
don't think the compiler should call [[deepCopy]].

[[delete]] maps to removeChild().

[[deleteByIndex]] maps to removeChildAt() methods.  The implementation
probably needs to throw the TypeError if removeChildAt() is called on an
XML object.  For now, I think you'll get an NPE if there isn't a
removeChildAt() on XML.

[[defaultValue]] This is not currently implemented in the compiler.  We
should probably take this on when we get around to handling other
ActionScript automatic type conversions.

[[hasProperty]] This is not currently implemented in the compiler.

[[deepCopy]] I think the compiler doesn't need to do anything here and the
implementation will handle it.

[[descendants]] The compiler is mapping ".." to descendants() calls.

[[equals]] The compiler will have to look for "==" and call and equals()
method.

[[resolveValue]] I'm not quite sure what to do here.

[[insert]] I think the compiler doesn't need to do anything here and the
implementation will handle it.

[[replace]] I think the compiler doesn't need to do anything here and the
implementation will handle it.

[[addInScopeNamespaces]] I think the compiler doesn't need to do anything
here and the implementation will handle it.

[[append]] maps to concat()


Another area of work is handling things like:

-typeof

-instanceof

These are already caught and converted to calls to
org.apache.flex.utils.Language.  I think the Language implementation will
have to become smart about XML.

Thoughts?
-Alex


On 2/8/16, 8:30 AM, "Alex Harui" <ah...@adobe.com> wrote:

>
>
>On 2/8/16, 1:00 AM, "Harbs" <ha...@gmail.com> wrote:
>>However the spec does not specify bracket notation internally, so that’s
>>not very clear. It could just be I’m not very experienced at reading
>>specification documentation… ;-)
>
>I'm not good at reading specs, probably because I find it boring.  This
>spec [1] seems to describe some not-so-common notation like the double
>brackets in section 9.1.1.
>
>[1] 
>http://www.ecma-international.org/publications/files/ECMA-ST-WITHDRAWN/Ecm
>a
>-357.pdf
>
>
>>
>>I have implemented some of the internal methods/properties, but not all.
>>I’m not sure it makes sense to implement them all.
>
>Implementing the internal methods/properties does not seem to be required
>by the spec.  But which ones are you thinking of skipping?
>
>>
>>It could be it makes sense to modify things a bit, but right now my
>>priority is to get all this working. Apparently, some feel that the ECMA
>>spec has some problems with it which might have been patched[1], but I’m
>>not sure exactly which.
>
>There could certainly be bugs everywhere: in the spec, in the Flash
>implementation, in the Mozilla implementation which apparently isn't
>available anymore.
>
>>
>>Right now, I’m pretty close to having all the methods in place (after
>>quite a few rewrites). The only thing I have not even started on is
>>filtering. I have no actually tried to compile any of this, so that will
>>be a whole task in itself. (BTW, you can see what I currently have done
>>in the e4x branch.)
>
>I have not looked closely at what you committed, but I'm quite excited
>that you are making any sort of progress on this.
>
>>
>>So here’s my current plan:
>>1. Finish up the methods (minus filtering) in the next day or two.
>>2. Sync up XML with the current FlexJS folder structure and get rid of
>>some junk (like all the JXON classes).
>>3. Get this all to compile.
>>4. Figure out the whole filtering issue.
>>5. Create test cases.
>>
>>Once this is done (or mostly done), it probably makes sense to get a
>>sanity check and decide whether to rewrite some of what I’ve done.
>>
>>Makes sense?
>
>Sounds reasonable.  I spent more time skimming the spec this morning.  I
>think there are a lot more cases that the compiler doesn't handle.  You
>and I may need to coordinate on when to work on those things, not that I'm
>looking forward to having to do all that work.  The key to success looks
>like it will be how the compiler can or can't know the resolved type of
>something.  The spec is about how to change the runtime, but we can't
>change the runtime and need to detect when an object is XML and generate
>different code.  I have some concerns about whether that will start to
>affect compiler performance, but I guess we'll just have to see, or maybe
>I'll put XML checking in some conditional so you can opt in.
>
>The link you posted didn't seem to point to any particular bug in E4X, but
>it was an interesting discussion in how the JS runtimes don't want to take
>on the complexity of E4X.  It would be interesting if there is a
>functional subset of E4X that we could implement that would draw in the
>E4X folks, especially the Node folks that appear to be stuck with handling
>XML documents for legacy support reasons.
>
>>
>>[1]https://bugs.chromium.org/p/v8/issues/detail?id=235#c75
>
>-Alex
>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 2/8/16, 1:00 AM, "Harbs" <ha...@gmail.com> wrote:
>However the spec does not specify bracket notation internally, so that’s
>not very clear. It could just be I’m not very experienced at reading
>specification documentation… ;-)

I'm not good at reading specs, probably because I find it boring.  This
spec [1] seems to describe some not-so-common notation like the double
brackets in section 9.1.1.

[1] 
http://www.ecma-international.org/publications/files/ECMA-ST-WITHDRAWN/Ecma
-357.pdf


>
>I have implemented some of the internal methods/properties, but not all.
>I’m not sure it makes sense to implement them all.

Implementing the internal methods/properties does not seem to be required
by the spec.  But which ones are you thinking of skipping?

>
>It could be it makes sense to modify things a bit, but right now my
>priority is to get all this working. Apparently, some feel that the ECMA
>spec has some problems with it which might have been patched[1], but I’m
>not sure exactly which.

There could certainly be bugs everywhere: in the spec, in the Flash
implementation, in the Mozilla implementation which apparently isn't
available anymore.

>
>Right now, I’m pretty close to having all the methods in place (after
>quite a few rewrites). The only thing I have not even started on is
>filtering. I have no actually tried to compile any of this, so that will
>be a whole task in itself. (BTW, you can see what I currently have done
>in the e4x branch.)

I have not looked closely at what you committed, but I'm quite excited
that you are making any sort of progress on this.

>
>So here’s my current plan:
>1. Finish up the methods (minus filtering) in the next day or two.
>2. Sync up XML with the current FlexJS folder structure and get rid of
>some junk (like all the JXON classes).
>3. Get this all to compile.
>4. Figure out the whole filtering issue.
>5. Create test cases.
>
>Once this is done (or mostly done), it probably makes sense to get a
>sanity check and decide whether to rewrite some of what I’ve done.
>
>Makes sense?

Sounds reasonable.  I spent more time skimming the spec this morning.  I
think there are a lot more cases that the compiler doesn't handle.  You
and I may need to coordinate on when to work on those things, not that I'm
looking forward to having to do all that work.  The key to success looks
like it will be how the compiler can or can't know the resolved type of
something.  The spec is about how to change the runtime, but we can't
change the runtime and need to detect when an object is XML and generate
different code.  I have some concerns about whether that will start to
affect compiler performance, but I guess we'll just have to see, or maybe
I'll put XML checking in some conditional so you can opt in.

The link you posted didn't seem to point to any particular bug in E4X, but
it was an interesting discussion in how the JS runtimes don't want to take
on the complexity of E4X.  It would be interesting if there is a
functional subset of E4X that we could implement that would draw in the
E4X folks, especially the Node folks that appear to be stuck with handling
XML documents for legacy support reasons.

>
>[1]https://bugs.chromium.org/p/v8/issues/detail?id=235#c75

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 2/12/16, 2:03 AM, "Harbs" <ha...@gmail.com> wrote:
>
>How do we simplify setting environment variables?

I think the problem is that some of the default setting logic in the main
flex-asjs/build.xml needs to be propagated to each individual project's.
It is hard to know what configurations folks will use.  Try copying the
check-falcon-home and check-falconjx-home targets and see if that makes
things better.

HTH,
-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Yes I did have an env.properties file. But the paths seem to be right, and removing it did not make a difference.

It’s good to know it’s not needed though…

On Feb 15, 2016, at 5:01 PM, Alex Harui <ah...@adobe.com> wrote:

> This implies you still have environment variables set somehow.  The
> defaults would use relative paths with ../ in them.
> Do you have an env.properties file or local.properties file?


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by jude <fl...@gmail.com>.
I don't but let's say Ant does something that AIR doesn't. You can call
just that one behavior. Get download or unzip file. You would have a single
function target.

I don't think it has to be installed. So you can bundle ant with the app.
Just put it in a subdirectory and then call ant /path/to/build.xml
name_of_target.

On Thu, Feb 18, 2016 at 9:54 PM, Alex Harui <ah...@adobe.com> wrote:

>
>
> On 2/18/16, 11:30 AM, "jude" <fl...@gmail.com> wrote:
>
> >it's possible to call ant using native process though. so you could fall
> >back on those few cases that ant is required.'
>
> Sure, that's possible, but I thought you didn't want to use Ant syntax in
> the first place.  And even if you do, you have to deal with making sure
> Ant is properly installed.
>
> -Alex
>
>

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 2/18/16, 11:30 AM, "jude" <fl...@gmail.com> wrote:

>it's possible to call ant using native process though. so you could fall
>back on those few cases that ant is required.'

Sure, that's possible, but I thought you didn't want to use Ant syntax in
the first place.  And even if you do, you have to deal with making sure
Ant is properly installed.

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by jude <fl...@gmail.com>.
it's possible to call ant using native process though. so you could fall
back on those few cases that ant is required.
On Feb 17, 2016 10:50 PM, "Alex Harui" <ah...@adobe.com> wrote:

>
>
> On 2/17/16, 10:34 PM, "Justin Mclean" <ju...@classsoftware.com> wrote:
>
> >Hi,
> >
> >> But Windows doesn't even have native processes for grep and sed and
> >> requiring CygWin or GitBash doesn't seem like a good idea.
> >
> >ActionScript has RegExp support [1] so an AIR grep wouldn’t be too hard
> >to create. Remind me what do the build scripts use grep for?
>
> I don't think our builds call out to grep explicitly, but we do use the
> ReplaceRegExp Ant task in some cases and I'm not sure we have AntOnAIR
> fully equivalent.
>
> AntOnAIR currently has enough to run the installer.xml scripts, but I
> think it is missing stuff we use in our build.xml and download.xml files.
> Tar/Jar also come to mind.  And, of course, it is still mimic-ing Ant,
> which some folks don't like.
>
> The AntOnAIR project has a tests/AntOnAIR.mxml which in theory you can
> feed the command line "-f <some ant script>" and see how far it gets with
> our build.xml files.
>
> -Alex
>
>
>
>

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 2/17/16, 10:34 PM, "Justin Mclean" <ju...@classsoftware.com> wrote:

>Hi,
>
>> But Windows doesn't even have native processes for grep and sed and
>> requiring CygWin or GitBash doesn't seem like a good idea.
>
>ActionScript has RegExp support [1] so an AIR grep wouldn’t be too hard
>to create. Remind me what do the build scripts use grep for?

I don't think our builds call out to grep explicitly, but we do use the
ReplaceRegExp Ant task in some cases and I'm not sure we have AntOnAIR
fully equivalent.

AntOnAIR currently has enough to run the installer.xml scripts, but I
think it is missing stuff we use in our build.xml and download.xml files.
Tar/Jar also come to mind.  And, of course, it is still mimic-ing Ant,
which some folks don't like.

The AntOnAIR project has a tests/AntOnAIR.mxml which in theory you can
feed the command line "-f <some ant script>" and see how far it gets with
our build.xml files.

-Alex




Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

> But Windows doesn't even have native processes for grep and sed and
> requiring CygWin or GitBash doesn't seem like a good idea.

ActionScript has RegExp support [1] so an AIR grep wouldn’t be too hard to create. Remind me what do the build scripts use grep for?

Thanks,
Justin

1. http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/RegExp.html

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 2/17/16, 5:47 PM, "jude" <fl...@gmail.com> wrote:

>If AIR has a comparable API use that, if it doesn't then use native
>process. And instead of environment variables use GUI and save those
>values
>to a shared object.

But Windows doesn't even have native processes for grep and sed and
requiring CygWin or GitBash doesn't seem like a good idea.   And saving to
a shared object doesn't help you run Ant on your CI server.

But again, if you want to take a shot at it, I'd be interested to see what
you come up with.

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by jude <fl...@gmail.com>.
If AIR has a comparable API use that, if it doesn't then use native
process. And instead of environment variables use GUI and save those values
to a shared object.


On 2/15/16, 5:17 PM, "jude" <fl...@gmail.com> wrote:

>some ideas: the first time I used ant I loved it but as soon as i asked it
>to do anything complex it became a major pain, imo.
>
>when I was helping harbs with TLF it took me a week and a lot of patience
>to get it setup.
>
>I understand why there are build engineers now. I'm really hesitant to try
>and make ant work with any project.

So what do you use instead of Ant?

>
>but for people like me, and others the process has to be easier to set up.
>I'm not saying that's for you to do but I think it would be better to use
>actionscript instead. why not create an AIR app? use as3 to check for
>environment variables, ask for directories, use those with the file class
>to copy things where they need to go. have a build button. maybe it's not
>possible. idk.

IMO, Ant and Maven take care of a lot of cross-platform stuff that AIR
doesn't (grep, sed, etc).  We have emulated a significant number of Ant
tasks in AS already, but some of the hard ones are missing.  And if I
deploy and AIR app, it needs its own release cycle.  IMO, too much work
for the benefit for me to want to stop feature development to work on it.
But definitely give it a try if you are so inclined.

I'm not saying it isn't complex, and I do wish it was easier, but this is
the 4th time I've devoted at least a day to trying to make it easier.  And
so far, it hasn't seemed to move the needle.  Maybe it will this time.

-Alex

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 2/15/16, 5:17 PM, "jude" <fl...@gmail.com> wrote:

>some ideas: the first time I used ant I loved it but as soon as i asked it
>to do anything complex it became a major pain, imo.
>
>when I was helping harbs with TLF it took me a week and a lot of patience
>to get it setup.
>
>I understand why there are build engineers now. I'm really hesitant to try
>and make ant work with any project.

So what do you use instead of Ant?

>
>but for people like me, and others the process has to be easier to set up.
>I'm not saying that's for you to do but I think it would be better to use
>actionscript instead. why not create an AIR app? use as3 to check for
>environment variables, ask for directories, use those with the file class
>to copy things where they need to go. have a build button. maybe it's not
>possible. idk.

IMO, Ant and Maven take care of a lot of cross-platform stuff that AIR
doesn't (grep, sed, etc).  We have emulated a significant number of Ant
tasks in AS already, but some of the hard ones are missing.  And if I
deploy and AIR app, it needs its own release cycle.  IMO, too much work
for the benefit for me to want to stop feature development to work on it.
But definitely give it a try if you are so inclined.

I'm not saying it isn't complex, and I do wish it was easier, but this is
the 4th time I've devoted at least a day to trying to make it easier.  And
so far, it hasn't seemed to move the needle.  Maybe it will this time.

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by jude <fl...@gmail.com>.
some ideas: the first time I used ant I loved it but as soon as i asked it
to do anything complex it became a major pain, imo.

when I was helping harbs with TLF it took me a week and a lot of patience
to get it setup.

I understand why there are build engineers now. I'm really hesitant to try
and make ant work with any project.

but for people like me, and others the process has to be easier to set up.
I'm not saying that's for you to do but I think it would be better to use
actionscript instead. why not create an AIR app? use as3 to check for
environment variables, ask for directories, use those with the file class
to copy things where they need to go. have a build button. maybe it's not
possible. idk.

I'm not saying this is for you to do but if install and run was an as3 app
any of us could debug it and even write parts if it. just an idea. in fact,
I might be able to help on it. I'll see if I can get something started this
week if there's interest.
On Feb 15, 2016 2:38 PM, "Alex Harui" <ah...@adobe.com> wrote:

> I have not seen anyone offer to make a fix.  I am mostly done with a
> change. Hopefully it will go in tonight.
>
>
> Sent from my LG G3, an AT&T 4G LTE smartphone
>
>
> ------ Original message------
>
> From: OmPrakash Muppirala
>
> Date: Mon, Feb 15, 2016 1:55 PM
>
> To: dev@flex.apache.org;
>
> Subject:Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)
>
>
> Alex,
>
> The way I am reading this thread, I don't think folks are asking you to
> make the changes.  They are generally asking if it is okay to make these
> kind of changes.  It would be good if you are okay with the changes since
> you are one of the affected parties.
>
> Thanks,
> Om
>
> On Mon, Feb 15, 2016 at 1:36 PM, Alex Harui <ah...@adobe.com> wrote:
>
> >
> >
> > On 2/15/16, 1:32 PM, "Michael Schmalle" <te...@gmail.com>
> wrote:
> >
> > >Alex, if I had time I wouldn't do it. :) I hate build stuff and this is
> > >exactly why I set that template file up.
> >
> > Well, I'm glad it worked for you, and it worked for me, but now I am
> > spending time trying to implement something else to make others happy.
> > Yes, we want to make it easier for others to contribute, but I don't like
> > it that it always falls on me to try to figure it out for others.
> >
> > -Alex
> >
> >
>

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 2/16/16, 12:29 AM, "Harbs" <ha...@gmail.com> wrote:

>Point taken.
>
>I’ll spend some time today and see if I can figure it out. If I have
>trouble, I might come back and ask you for help… ;-)

Well, try the latest changes in the post I just sent.

You and others are always welcome to ask for help, but please have
realistic expectations of how polished this technology is and what is best
for the project as a whole.  It would not make sense to me to kick off the
FlexJS event in San Francisco by showing that you can click on something
and build the entire code base, but the code base has no new features
since 0.5.0.

Maybe you don't like environment variables, but maybe for now you'll have
to live with them.  I generally put them in scripts so I don't have to
have defaults baked into the system settings and that encapsulates the set
of variables that I need for various purposes.

I actually think I got env.properties to work properly, but we'll see.
I'm up way later than I should be so I'll won't be answering any questions
for the next several hours, so good luck.

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Point taken.

I’ll spend some time today and see if I can figure it out. If I have trouble, I might come back and ask you for help… ;-)

On Feb 16, 2016, at 10:16 AM, Alex Harui <ah...@adobe.com> wrote:

> 
> 
> On 2/15/16, 11:44 PM, "Harbs" <ha...@gmail.com> wrote:
> 
>> I would definitely work on this if I knew how. My level of expertise
>> using ant is about good enough to look at a build file and get a general
>> idea of how it works.
> 
> Before Flex came to Apache, I didn't know much about Ant either.  We had
> folks who did that sort of stuff at Adobe.  But  I was forced to learn it.
> You're a smart guy, you could learn it too if motivated enough.
> 
> But, because you are a volunteer and your time is limited, I guess that
> gives you the right to say, "well, if it isn't as easy as I want it to be,
> I can't contribute".  And that puts the onus on the few of us who have
> more time to do the not-so-fun stuff.  Which isn't fun.  Which is why I'm
> complaining.  Like or not, this stuff is the bleeding edge.  I really
> don't see much advantage to the community to polish stuff that might
> change soon.  I had hoped we could draw in more folks who could put up
> with the bleeding edge, but apparently we can't.  Folks can just say "I
> don't want to know how you work, this is how I want to work" and I have to
> try to figure out what the difference is and try to get the build system
> to conform to it.
> 
>> 
>> The Flex builds seem really complex to me and I’m not even sure what all
>> the dependencies are.
> 
> Agreed that it is complex.  I could probably stop developing new features
> and try to make it simpler.  The README and LICENSE hopefully document the
> dependencies.
> 
> -Alex
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 2/15/16, 11:44 PM, "Harbs" <ha...@gmail.com> wrote:

>I would definitely work on this if I knew how. My level of expertise
>using ant is about good enough to look at a build file and get a general
>idea of how it works.

Before Flex came to Apache, I didn't know much about Ant either.  We had
folks who did that sort of stuff at Adobe.  But  I was forced to learn it.
 You're a smart guy, you could learn it too if motivated enough.

But, because you are a volunteer and your time is limited, I guess that
gives you the right to say, "well, if it isn't as easy as I want it to be,
I can't contribute".  And that puts the onus on the few of us who have
more time to do the not-so-fun stuff.  Which isn't fun.  Which is why I'm
complaining.  Like or not, this stuff is the bleeding edge.  I really
don't see much advantage to the community to polish stuff that might
change soon.  I had hoped we could draw in more folks who could put up
with the bleeding edge, but apparently we can't.  Folks can just say "I
don't want to know how you work, this is how I want to work" and I have to
try to figure out what the difference is and try to get the build system
to conform to it.

>
>The Flex builds seem really complex to me and I’m not even sure what all
>the dependencies are.

Agreed that it is complex.  I could probably stop developing new features
and try to make it simpler.  The README and LICENSE hopefully document the
dependencies.

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
I would definitely work on this if I knew how. My level of expertise using ant is about good enough to look at a build file and get a general idea of how it works.

The Flex builds seem really complex to me and I’m not even sure what all the dependencies are.

On Feb 16, 2016, at 12:38 AM, Alex Harui <ah...@adobe.com> wrote:

> I have not seen anyone offer to make a fix.  I am mostly done with a change. Hopefully it will go in tonight.
> 
> 
> Sent from my LG G3, an AT&T 4G LTE smartphone
> 
> 
> ------ Original message------
> 
> From: OmPrakash Muppirala
> 
> Date: Mon, Feb 15, 2016 1:55 PM
> 
> To: dev@flex.apache.org;
> 
> Subject:Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)
> 
> 
> Alex,
> 
> The way I am reading this thread, I don't think folks are asking you to
> make the changes.  They are generally asking if it is okay to make these
> kind of changes.  It would be good if you are okay with the changes since
> you are one of the affected parties.
> 
> Thanks,
> Om
> 
> On Mon, Feb 15, 2016 at 1:36 PM, Alex Harui <ah...@adobe.com> wrote:
> 
>> 
>> 
>> On 2/15/16, 1:32 PM, "Michael Schmalle" <te...@gmail.com> wrote:
>> 
>>> Alex, if I had time I wouldn't do it. :) I hate build stuff and this is
>>> exactly why I set that template file up.
>> 
>> Well, I'm glad it worked for you, and it worked for me, but now I am
>> spending time trying to implement something else to make others happy.
>> Yes, we want to make it easier for others to contribute, but I don't like
>> it that it always falls on me to try to figure it out for others.
>> 
>> -Alex
>> 
>> 


Re: [FALCONJX]Compiling Falcon with externs problems

Posted by Alex Harui <ah...@adobe.com>.
Glad you got it to work.  Somehow, I messed up my Git commands and the
env.properties change for flex-falcon got stashed instead of committed.  I
just pushed It now, so you shouldn't need unittest.properties any more.
An env.properties file will override unittest.properties.

-Alex

On 2/16/16, 4:33 AM, "Harbs" <ha...@gmail.com> wrote:

>Yay!
>
>I got asjs to compile and XML compiles as well. The build failed because
>of errors, but at least the errors make sense.
>
>I can now get back to work. Phew!
>
>Thanks Alex for bearing with me… ;-)
>
>FWIW, I put together some instructions in a Google Doc with things that
>tripped me up. I’ll put it in the wiki when it makes sense.
>https://docs.google.com/document/d/1na0UI3c_d0c6EroVLzNTaUGLoPXeD5Y9v-s-Rg
>X1ohQ/edit?usp=sharing
>
>Harbs
>
>On Feb 16, 2016, at 2:17 PM, Harbs <ha...@gmail.com> wrote:
>
>> OK.
>> 
>> It looks like my problem was due to some outdated files from previous
>>compilations.
>> 
>> I completely removed the flex-falcon folder and checked out a fresh
>>copy of the repo, and my problems seem to have gone away.
>> 
>> I just got a successful build of falcon! :-)
>> 
>> Trying to compile asjs now…
>> 
>> On Feb 16, 2016, at 12:19 PM, Harbs <ha...@gmail.com> wrote:
>> 
>>> Renaming this because this has nothing to do with XML.
>>> 
>>> I’ve been trying various things related to the externs and nothing I’m
>>>doing seems to be right.
>>> 
>>> 1. Running it with all my existing externs files causes an error that
>>>Window and Console are undefined.
>>> 2. Removing the js externs files causes an error because svg.js is
>>>missing when the js compile-config file looks for it in line 71.
>>> 3. Adding just svg.js back in causes an error on line 56 because the
>>>interfaces path is missing (I cleared out the “out” folder thinking it
>>>would get regenerated.)
>>> 
>>> I looked through the build script to try and find where the externs
>>>files are supposed to be downloaded, but I could not find it. I’m also
>>>having trouble following the order of events in terms of generating the
>>>extern-related files.
>>> 
>>> I’m out of time for this morning. I’ll try again later, but if anyone
>>>can give me some pointers, it might help this lost traveler… ;-)
>>> 
>>> Harbs
>>> 
>>> On Feb 16, 2016, at 11:14 AM, Harbs <ha...@gmail.com> wrote:
>>> 
>>>> It looks improved to me. I still needed to add the
>>>>unittest.properties file, but that’s fine.
>>>> 
>>>> I now seem to be getting stuck on externs. I’m trying to figure out
>>>>what’s not set up properly on my machine, but if anyone has pointers
>>>>please pipe up.
>>>> 
>>>> externc.js.swc:
>>>>      [java] Feb 16, 2016 11:05:24 AM
>>>>com.google.javascript.jscomp.LoggerErrorManager println
>>>>      [java] WARNING: [es6]:87: WARNING - Keywords and reserved words
>>>>are not allowed as unquoted property names in older versions of
>>>>JavaScript. If you are targeting newer versions of JavaScript, set the
>>>>appropriate language_in option.
>>>>      [java] Generator.prototype.return = function(value) {};
>>>>      [java]                     ^
>>>>      [java] 
>>>>      [java] Feb 16, 2016 11:05:24 AM
>>>>com.google.javascript.jscomp.LoggerErrorManager println
>>>>      [java] WARNING: [es6]:93: WARNING - Keywords and reserved words
>>>>are not allowed as unquoted property names in older versions of
>>>>JavaScript. If you are targeting newer versions of JavaScript, set the
>>>>appropriate language_in option.
>>>>      [java] Generator.prototype.throw = function(exception) {};
>>>>      [java]                     ^
>>>>      [java] 
>>>>      [java] Feb 16, 2016 11:05:24 AM
>>>>com.google.javascript.jscomp.LoggerErrorManager println
>>>>      [java] WARNING: [es6]:898: WARNING - Keywords and reserved words
>>>>are not allowed as unquoted property names in older versions of
>>>>JavaScript. If you are targeting newer versions of JavaScript, set the
>>>>appropriate language_in option.
>>>>      [java] Promise.prototype.catch = function(onRejected) {};
>>>>      [java]                   ^
>>>>      [java] 
>>>>      [java] Feb 16, 2016 11:05:24 AM
>>>>com.google.javascript.jscomp.LoggerErrorManager println
>>>>      [java] SEVERE: [missing]:91: ERROR - Parse error. identifier is
>>>>a reserved word
>>>>      [java] function int() {}
>>>>      [java]          ^
>>>>      [java] 
>>>>      [java] Feb 16, 2016 11:05:24 AM
>>>>com.google.javascript.jscomp.LoggerErrorManager println
>>>>      [java] SEVERE: [missing]:97: ERROR - Parse error. identifier is
>>>>a reserved word
>>>>      [java] int.prototype.toString = function(opt_radix) {}
>>>>      [java] ^
>>>>      [java] 
>>>>      [java] Feb 16, 2016 11:05:24 AM
>>>>com.google.javascript.jscomp.LoggerErrorManager printSummary
>>>>      [java] WARNING: 2 error(s), 3 warning(s)
>>>>      [java] 0.839131 seconds
>>>>      [java] Java Result: 255
>>>>      [copy] Copying 1 file to
>>>>/Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes
>>>>     [mkdir] Created dir:
>>>>/Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes
>>>>/__AS3__/vec
>>>>      [copy] Copying 1 file to
>>>>/Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes
>>>>/__AS3__/vec
>>>>      [copy] Copying 1 file to
>>>>/Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes
>>>>/__AS3__/vec
>>>>      [copy] Copying 1 file to
>>>>/Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes
>>>>/__AS3__/vec
>>>>      [copy] Copying 1 file to
>>>>/Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes
>>>>/__AS3__/vec
>>>>      [copy] Copying 1 file to
>>>>/Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes
>>>>/__AS3__/vec
>>>>      [java] Loading configuration:
>>>>/Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/compile-config
>>>>.xml
>>>>      [java] 
>>>>      [java] 
>>>>/Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/constan
>>>>ts/console.as:3
>>>>      [java] Error: Type was not found or was not a compile-time
>>>>constant: Console.
>>>>      [java]     public const console:Console = undefined;
>>>>      [java]                          ^
>>>>      [java] 
>>>>      [java] 
>>>>/Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/constan
>>>>ts/window.as:3
>>>>      [java] Error: Type was not found or was not a compile-time
>>>>constant: Window.
>>>>      [java]     public const window:Window = undefined;
>>>>      [java]                         ^
>>>>      [java] 
>>>> 
>>>> BUILD FAILED
>>>> /Users/harbs/Documents/ApacheFlex/flex-asjs/build.xml:1552: The
>>>>following error occurred while executing this line:
>>>> /Users/harbs/Documents/ApacheFlex/flex-asjs/build.xml:1693: The
>>>>following error occurred while executing this line:
>>>> /Users/harbs/Documents/ApacheFlex/flex-falcon/build.xml:674: Java
>>>>returned: 2
>>>> 
>>>> On Feb 16, 2016, at 10:36 AM, Harbs <ha...@gmail.com> wrote:
>>>> 
>>>>> Thanks for that. I’ll give it a go. If it does not work, I’ll try
>>>>>and figure out why without “complaining” first… ;-)
>>>>> 
>>>>> On Feb 16, 2016, at 10:32 AM, Alex Harui <ah...@adobe.com> wrote:
>>>>> 
>>>>>> 
>>>>>> 
>>>>>> On 2/15/16, 2:38 PM, "Alex Harui" <ah...@adobe.com> wrote:
>>>>>> 
>>>>>>> I have not seen anyone offer to make a fix.  I am mostly done with
>>>>>>>a
>>>>>>> change. Hopefully it will go in tonight.
>>>>>>> 
>>>>>> 
>>>>>> OK, I pushed changes to flex-falcon and flex-asjs.
>>>>>> 
>>>>>> In each of flex-falcon, flex-sdk and flex-asjs, set up an
>>>>>>env.properties
>>>>>> file by copying the env-template.properties file in the root of
>>>>>>each repo
>>>>>> (they are slightly different).
>>>>>> 
>>>>>> In each of the env.properties files, I think you only need to set
>>>>>> AIR_HOME, PLAYERGLOBAL_HOME and FLASHPLAYER_DEBUGGER.  Leave the
>>>>>>rest
>>>>>> commented out.
>>>>>> 
>>>>>> Then for me, running "ant all" in flex-asjs, built everything
>>>>>> successfully.  I'll bet I missed something somewhere, but maybe
>>>>>>we'll get
>>>>>> lucky.
>>>>>> 
>>>>>> -Alex
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
>


Re: [FALCONJX]Compiling Falcon with externs problems

Posted by Harbs <ha...@gmail.com>.
Yay!

I got asjs to compile and XML compiles as well. The build failed because of errors, but at least the errors make sense.

I can now get back to work. Phew!

Thanks Alex for bearing with me… ;-)

FWIW, I put together some instructions in a Google Doc with things that tripped me up. I’ll put it in the wiki when it makes sense.
https://docs.google.com/document/d/1na0UI3c_d0c6EroVLzNTaUGLoPXeD5Y9v-s-RgX1ohQ/edit?usp=sharing

Harbs

On Feb 16, 2016, at 2:17 PM, Harbs <ha...@gmail.com> wrote:

> OK.
> 
> It looks like my problem was due to some outdated files from previous compilations.
> 
> I completely removed the flex-falcon folder and checked out a fresh copy of the repo, and my problems seem to have gone away.
> 
> I just got a successful build of falcon! :-)
> 
> Trying to compile asjs now…
> 
> On Feb 16, 2016, at 12:19 PM, Harbs <ha...@gmail.com> wrote:
> 
>> Renaming this because this has nothing to do with XML.
>> 
>> I’ve been trying various things related to the externs and nothing I’m doing seems to be right.
>> 
>> 1. Running it with all my existing externs files causes an error that Window and Console are undefined.
>> 2. Removing the js externs files causes an error because svg.js is missing when the js compile-config file looks for it in line 71.
>> 3. Adding just svg.js back in causes an error on line 56 because the interfaces path is missing (I cleared out the “out” folder thinking it would get regenerated.)
>> 
>> I looked through the build script to try and find where the externs files are supposed to be downloaded, but I could not find it. I’m also having trouble following the order of events in terms of generating the extern-related files.
>> 
>> I’m out of time for this morning. I’ll try again later, but if anyone can give me some pointers, it might help this lost traveler… ;-)
>> 
>> Harbs
>> 
>> On Feb 16, 2016, at 11:14 AM, Harbs <ha...@gmail.com> wrote:
>> 
>>> It looks improved to me. I still needed to add the unittest.properties file, but that’s fine.
>>> 
>>> I now seem to be getting stuck on externs. I’m trying to figure out what’s not set up properly on my machine, but if anyone has pointers please pipe up.
>>> 
>>> externc.js.swc:
>>>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>>>      [java] WARNING: [es6]:87: WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
>>>      [java] Generator.prototype.return = function(value) {};
>>>      [java]                     ^
>>>      [java] 
>>>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>>>      [java] WARNING: [es6]:93: WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
>>>      [java] Generator.prototype.throw = function(exception) {};
>>>      [java]                     ^
>>>      [java] 
>>>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>>>      [java] WARNING: [es6]:898: WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
>>>      [java] Promise.prototype.catch = function(onRejected) {};
>>>      [java]                   ^
>>>      [java] 
>>>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>>>      [java] SEVERE: [missing]:91: ERROR - Parse error. identifier is a reserved word
>>>      [java] function int() {}
>>>      [java]          ^
>>>      [java] 
>>>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>>>      [java] SEVERE: [missing]:97: ERROR - Parse error. identifier is a reserved word
>>>      [java] int.prototype.toString = function(opt_radix) {}
>>>      [java] ^
>>>      [java] 
>>>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager printSummary
>>>      [java] WARNING: 2 error(s), 3 warning(s)
>>>      [java] 0.839131 seconds
>>>      [java] Java Result: 255
>>>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes
>>>     [mkdir] Created dir: /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>>>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>>>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>>>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>>>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>>>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>>>      [java] Loading configuration: /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/compile-config.xml
>>>      [java] 
>>>      [java] /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/constants/console.as:3
>>>      [java] Error: Type was not found or was not a compile-time constant: Console.
>>>      [java]     public const console:Console = undefined;
>>>      [java]                          ^
>>>      [java] 
>>>      [java] /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/constants/window.as:3
>>>      [java] Error: Type was not found or was not a compile-time constant: Window.
>>>      [java]     public const window:Window = undefined;
>>>      [java]                         ^
>>>      [java] 
>>> 
>>> BUILD FAILED
>>> /Users/harbs/Documents/ApacheFlex/flex-asjs/build.xml:1552: The following error occurred while executing this line:
>>> /Users/harbs/Documents/ApacheFlex/flex-asjs/build.xml:1693: The following error occurred while executing this line:
>>> /Users/harbs/Documents/ApacheFlex/flex-falcon/build.xml:674: Java returned: 2
>>> 
>>> On Feb 16, 2016, at 10:36 AM, Harbs <ha...@gmail.com> wrote:
>>> 
>>>> Thanks for that. I’ll give it a go. If it does not work, I’ll try and figure out why without “complaining” first… ;-)
>>>> 
>>>> On Feb 16, 2016, at 10:32 AM, Alex Harui <ah...@adobe.com> wrote:
>>>> 
>>>>> 
>>>>> 
>>>>> On 2/15/16, 2:38 PM, "Alex Harui" <ah...@adobe.com> wrote:
>>>>> 
>>>>>> I have not seen anyone offer to make a fix.  I am mostly done with a
>>>>>> change. Hopefully it will go in tonight.
>>>>>> 
>>>>> 
>>>>> OK, I pushed changes to flex-falcon and flex-asjs.
>>>>> 
>>>>> In each of flex-falcon, flex-sdk and flex-asjs, set up an env.properties
>>>>> file by copying the env-template.properties file in the root of each repo
>>>>> (they are slightly different).
>>>>> 
>>>>> In each of the env.properties files, I think you only need to set
>>>>> AIR_HOME, PLAYERGLOBAL_HOME and FLASHPLAYER_DEBUGGER.  Leave the rest
>>>>> commented out.
>>>>> 
>>>>> Then for me, running "ant all" in flex-asjs, built everything
>>>>> successfully.  I'll bet I missed something somewhere, but maybe we'll get
>>>>> lucky.
>>>>> 
>>>>> -Alex
>>>>> 
>>>> 
>>> 
>> 
> 


AW: [FALCONJX]Compiling Falcon with externs problems

Posted by Christofer Dutz <ch...@c-ware.de>.
Hi,

these are exactly the type of problems I was so sick of :-( Probably I was cursed by them more often, cause I didn't update my project that often. How about we do the same update of the directory structure as with some of the ASJS directories in Falcon too? This way we could make sure all generated and compiled stuff is located underneath a "target" directory and a simple delete would make sure that any legacy content is removed. 

And I could eventually whip up a parallel Maven build much easier ... wich would in turn result in automated SNAPSHOTs of Falcon, which would be the prerequisite of providing SNAPSHOT versions of FlexJS (ASJS)? I'd love to work on that.

And ... I am currently giving a 3-day Maven training for two insurance companies ... so my tutorials and slides are fresh and up-to-date. Think I'd be able to compress everything into a one day Maven bootcamp crash-course. If one of my Talks is selected for ApacheCon, then I'd be able to take the trip and I'd be glad to give a free Maven training, if there is any Interest in this. I would specially be delighted to give Alex and Om such a training so we could achieve a more common understanding for the topic, which would definitely benefit the project greatly cause we could actually start working in the same direction.

Chris

________________________________________
Von: Harbs <ha...@gmail.com>
Gesendet: Dienstag, 16. Februar 2016 13:17
An: dev@flex.apache.org
Betreff: Re: [FALCONJX]Compiling Falcon with externs problems

OK.

It looks like my problem was due to some outdated files from previous compilations.

I completely removed the flex-falcon folder and checked out a fresh copy of the repo, and my problems seem to have gone away.

I just got a successful build of falcon! :-)

Trying to compile asjs now…

On Feb 16, 2016, at 12:19 PM, Harbs <ha...@gmail.com> wrote:

> Renaming this because this has nothing to do with XML.
>
> I’ve been trying various things related to the externs and nothing I’m doing seems to be right.
>
> 1. Running it with all my existing externs files causes an error that Window and Console are undefined.
> 2. Removing the js externs files causes an error because svg.js is missing when the js compile-config file looks for it in line 71.
> 3. Adding just svg.js back in causes an error on line 56 because the interfaces path is missing (I cleared out the “out” folder thinking it would get regenerated.)
>
> I looked through the build script to try and find where the externs files are supposed to be downloaded, but I could not find it. I’m also having trouble following the order of events in terms of generating the extern-related files.
>
> I’m out of time for this morning. I’ll try again later, but if anyone can give me some pointers, it might help this lost traveler… ;-)
>
> Harbs
>
> On Feb 16, 2016, at 11:14 AM, Harbs <ha...@gmail.com> wrote:
>
>> It looks improved to me. I still needed to add the unittest.properties file, but that’s fine.
>>
>> I now seem to be getting stuck on externs. I’m trying to figure out what’s not set up properly on my machine, but if anyone has pointers please pipe up.
>>
>> externc.js.swc:
>>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>>      [java] WARNING: [es6]:87: WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
>>      [java] Generator.prototype.return = function(value) {};
>>      [java]                     ^
>>      [java]
>>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>>      [java] WARNING: [es6]:93: WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
>>      [java] Generator.prototype.throw = function(exception) {};
>>      [java]                     ^
>>      [java]
>>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>>      [java] WARNING: [es6]:898: WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
>>      [java] Promise.prototype.catch = function(onRejected) {};
>>      [java]                   ^
>>      [java]
>>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>>      [java] SEVERE: [missing]:91: ERROR - Parse error. identifier is a reserved word
>>      [java] function int() {}
>>      [java]          ^
>>      [java]
>>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>>      [java] SEVERE: [missing]:97: ERROR - Parse error. identifier is a reserved word
>>      [java] int.prototype.toString = function(opt_radix) {}
>>      [java] ^
>>      [java]
>>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager printSummary
>>      [java] WARNING: 2 error(s), 3 warning(s)
>>      [java] 0.839131 seconds
>>      [java] Java Result: 255
>>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes
>>     [mkdir] Created dir: /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>>      [java] Loading configuration: /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/compile-config.xml
>>      [java]
>>      [java] /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/constants/console.as:3
>>      [java] Error: Type was not found or was not a compile-time constant: Console.
>>      [java]     public const console:Console = undefined;
>>      [java]                          ^
>>      [java]
>>      [java] /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/constants/window.as:3
>>      [java] Error: Type was not found or was not a compile-time constant: Window.
>>      [java]     public const window:Window = undefined;
>>      [java]                         ^
>>      [java]
>>
>> BUILD FAILED
>> /Users/harbs/Documents/ApacheFlex/flex-asjs/build.xml:1552: The following error occurred while executing this line:
>> /Users/harbs/Documents/ApacheFlex/flex-asjs/build.xml:1693: The following error occurred while executing this line:
>> /Users/harbs/Documents/ApacheFlex/flex-falcon/build.xml:674: Java returned: 2
>>
>> On Feb 16, 2016, at 10:36 AM, Harbs <ha...@gmail.com> wrote:
>>
>>> Thanks for that. I’ll give it a go. If it does not work, I’ll try and figure out why without “complaining” first… ;-)
>>>
>>> On Feb 16, 2016, at 10:32 AM, Alex Harui <ah...@adobe.com> wrote:
>>>
>>>>
>>>>
>>>> On 2/15/16, 2:38 PM, "Alex Harui" <ah...@adobe.com> wrote:
>>>>
>>>>> I have not seen anyone offer to make a fix.  I am mostly done with a
>>>>> change. Hopefully it will go in tonight.
>>>>>
>>>>
>>>> OK, I pushed changes to flex-falcon and flex-asjs.
>>>>
>>>> In each of flex-falcon, flex-sdk and flex-asjs, set up an env.properties
>>>> file by copying the env-template.properties file in the root of each repo
>>>> (they are slightly different).
>>>>
>>>> In each of the env.properties files, I think you only need to set
>>>> AIR_HOME, PLAYERGLOBAL_HOME and FLASHPLAYER_DEBUGGER.  Leave the rest
>>>> commented out.
>>>>
>>>> Then for me, running "ant all" in flex-asjs, built everything
>>>> successfully.  I'll bet I missed something somewhere, but maybe we'll get
>>>> lucky.
>>>>
>>>> -Alex
>>>>
>>>
>>
>


Re: [FALCONJX]Compiling Falcon with externs problems

Posted by OmPrakash Muppirala <bi...@gmail.com>.
On Tue, Feb 16, 2016 at 4:17 AM, Harbs <ha...@gmail.com> wrote:

> OK.
>
> It looks like my problem was due to some outdated files from previous
> compilations.
>
> I completely removed the flex-falcon folder and checked out a fresh copy
> of the repo, and my problems seem to have gone away.
>

I just ran into this same issue.  I did ant wipe-all followed by ant all
and everything was fixed!

The wipe-all target has the same effect of getting a fresh copy of the repo.

Thanks,
Om


>
> I just got a successful build of falcon! :-)
>
> Trying to compile asjs now…
>
> On Feb 16, 2016, at 12:19 PM, Harbs <ha...@gmail.com> wrote:
>
> > Renaming this because this has nothing to do with XML.
> >
> > I’ve been trying various things related to the externs and nothing I’m
> doing seems to be right.
> >
> > 1. Running it with all my existing externs files causes an error that
> Window and Console are undefined.
> > 2. Removing the js externs files causes an error because svg.js is
> missing when the js compile-config file looks for it in line 71.
> > 3. Adding just svg.js back in causes an error on line 56 because the
> interfaces path is missing (I cleared out the “out” folder thinking it
> would get regenerated.)
> >
> > I looked through the build script to try and find where the externs
> files are supposed to be downloaded, but I could not find it. I’m also
> having trouble following the order of events in terms of generating the
> extern-related files.
> >
> > I’m out of time for this morning. I’ll try again later, but if anyone
> can give me some pointers, it might help this lost traveler… ;-)
> >
> > Harbs
> >
> > On Feb 16, 2016, at 11:14 AM, Harbs <ha...@gmail.com> wrote:
> >
> >> It looks improved to me. I still needed to add the unittest.properties
> file, but that’s fine.
> >>
> >> I now seem to be getting stuck on externs. I’m trying to figure out
> what’s not set up properly on my machine, but if anyone has pointers please
> pipe up.
> >>
> >> externc.js.swc:
> >>      [java] Feb 16, 2016 11:05:24 AM
> com.google.javascript.jscomp.LoggerErrorManager println
> >>      [java] WARNING: [es6]:87: WARNING - Keywords and reserved words
> are not allowed as unquoted property names in older versions of JavaScript.
> If you are targeting newer versions of JavaScript, set the appropriate
> language_in option.
> >>      [java] Generator.prototype.return = function(value) {};
> >>      [java]                     ^
> >>      [java]
> >>      [java] Feb 16, 2016 11:05:24 AM
> com.google.javascript.jscomp.LoggerErrorManager println
> >>      [java] WARNING: [es6]:93: WARNING - Keywords and reserved words
> are not allowed as unquoted property names in older versions of JavaScript.
> If you are targeting newer versions of JavaScript, set the appropriate
> language_in option.
> >>      [java] Generator.prototype.throw = function(exception) {};
> >>      [java]                     ^
> >>      [java]
> >>      [java] Feb 16, 2016 11:05:24 AM
> com.google.javascript.jscomp.LoggerErrorManager println
> >>      [java] WARNING: [es6]:898: WARNING - Keywords and reserved words
> are not allowed as unquoted property names in older versions of JavaScript.
> If you are targeting newer versions of JavaScript, set the appropriate
> language_in option.
> >>      [java] Promise.prototype.catch = function(onRejected) {};
> >>      [java]                   ^
> >>      [java]
> >>      [java] Feb 16, 2016 11:05:24 AM
> com.google.javascript.jscomp.LoggerErrorManager println
> >>      [java] SEVERE: [missing]:91: ERROR - Parse error. identifier is a
> reserved word
> >>      [java] function int() {}
> >>      [java]          ^
> >>      [java]
> >>      [java] Feb 16, 2016 11:05:24 AM
> com.google.javascript.jscomp.LoggerErrorManager println
> >>      [java] SEVERE: [missing]:97: ERROR - Parse error. identifier is a
> reserved word
> >>      [java] int.prototype.toString = function(opt_radix) {}
> >>      [java] ^
> >>      [java]
> >>      [java] Feb 16, 2016 11:05:24 AM
> com.google.javascript.jscomp.LoggerErrorManager printSummary
> >>      [java] WARNING: 2 error(s), 3 warning(s)
> >>      [java] 0.839131 seconds
> >>      [java] Java Result: 255
> >>      [copy] Copying 1 file to
> /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes
> >>     [mkdir] Created dir:
> /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
> >>      [copy] Copying 1 file to
> /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
> >>      [copy] Copying 1 file to
> /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
> >>      [copy] Copying 1 file to
> /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
> >>      [copy] Copying 1 file to
> /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
> >>      [copy] Copying 1 file to
> /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
> >>      [java] Loading configuration:
> /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/compile-config.xml
> >>      [java]
> >>      [java]
> /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/constants/
> console.as:3
> >>      [java] Error: Type was not found or was not a compile-time
> constant: Console.
> >>      [java]     public const console:Console = undefined;
> >>      [java]                          ^
> >>      [java]
> >>      [java]
> /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/constants/
> window.as:3
> >>      [java] Error: Type was not found or was not a compile-time
> constant: Window.
> >>      [java]     public const window:Window = undefined;
> >>      [java]                         ^
> >>      [java]
> >>
> >> BUILD FAILED
> >> /Users/harbs/Documents/ApacheFlex/flex-asjs/build.xml:1552: The
> following error occurred while executing this line:
> >> /Users/harbs/Documents/ApacheFlex/flex-asjs/build.xml:1693: The
> following error occurred while executing this line:
> >> /Users/harbs/Documents/ApacheFlex/flex-falcon/build.xml:674: Java
> returned: 2
> >>
> >> On Feb 16, 2016, at 10:36 AM, Harbs <ha...@gmail.com> wrote:
> >>
> >>> Thanks for that. I’ll give it a go. If it does not work, I’ll try and
> figure out why without “complaining” first… ;-)
> >>>
> >>> On Feb 16, 2016, at 10:32 AM, Alex Harui <ah...@adobe.com> wrote:
> >>>
> >>>>
> >>>>
> >>>> On 2/15/16, 2:38 PM, "Alex Harui" <ah...@adobe.com> wrote:
> >>>>
> >>>>> I have not seen anyone offer to make a fix.  I am mostly done with a
> >>>>> change. Hopefully it will go in tonight.
> >>>>>
> >>>>
> >>>> OK, I pushed changes to flex-falcon and flex-asjs.
> >>>>
> >>>> In each of flex-falcon, flex-sdk and flex-asjs, set up an
> env.properties
> >>>> file by copying the env-template.properties file in the root of each
> repo
> >>>> (they are slightly different).
> >>>>
> >>>> In each of the env.properties files, I think you only need to set
> >>>> AIR_HOME, PLAYERGLOBAL_HOME and FLASHPLAYER_DEBUGGER.  Leave the rest
> >>>> commented out.
> >>>>
> >>>> Then for me, running "ant all" in flex-asjs, built everything
> >>>> successfully.  I'll bet I missed something somewhere, but maybe we'll
> get
> >>>> lucky.
> >>>>
> >>>> -Alex
> >>>>
> >>>
> >>
> >
>
>

Re: [FALCONJX]Compiling Falcon with externs problems

Posted by Harbs <ha...@gmail.com>.
OK.

It looks like my problem was due to some outdated files from previous compilations.

I completely removed the flex-falcon folder and checked out a fresh copy of the repo, and my problems seem to have gone away.

I just got a successful build of falcon! :-)

Trying to compile asjs now…

On Feb 16, 2016, at 12:19 PM, Harbs <ha...@gmail.com> wrote:

> Renaming this because this has nothing to do with XML.
> 
> I’ve been trying various things related to the externs and nothing I’m doing seems to be right.
> 
> 1. Running it with all my existing externs files causes an error that Window and Console are undefined.
> 2. Removing the js externs files causes an error because svg.js is missing when the js compile-config file looks for it in line 71.
> 3. Adding just svg.js back in causes an error on line 56 because the interfaces path is missing (I cleared out the “out” folder thinking it would get regenerated.)
> 
> I looked through the build script to try and find where the externs files are supposed to be downloaded, but I could not find it. I’m also having trouble following the order of events in terms of generating the extern-related files.
> 
> I’m out of time for this morning. I’ll try again later, but if anyone can give me some pointers, it might help this lost traveler… ;-)
> 
> Harbs
> 
> On Feb 16, 2016, at 11:14 AM, Harbs <ha...@gmail.com> wrote:
> 
>> It looks improved to me. I still needed to add the unittest.properties file, but that’s fine.
>> 
>> I now seem to be getting stuck on externs. I’m trying to figure out what’s not set up properly on my machine, but if anyone has pointers please pipe up.
>> 
>> externc.js.swc:
>>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>>      [java] WARNING: [es6]:87: WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
>>      [java] Generator.prototype.return = function(value) {};
>>      [java]                     ^
>>      [java] 
>>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>>      [java] WARNING: [es6]:93: WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
>>      [java] Generator.prototype.throw = function(exception) {};
>>      [java]                     ^
>>      [java] 
>>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>>      [java] WARNING: [es6]:898: WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
>>      [java] Promise.prototype.catch = function(onRejected) {};
>>      [java]                   ^
>>      [java] 
>>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>>      [java] SEVERE: [missing]:91: ERROR - Parse error. identifier is a reserved word
>>      [java] function int() {}
>>      [java]          ^
>>      [java] 
>>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>>      [java] SEVERE: [missing]:97: ERROR - Parse error. identifier is a reserved word
>>      [java] int.prototype.toString = function(opt_radix) {}
>>      [java] ^
>>      [java] 
>>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager printSummary
>>      [java] WARNING: 2 error(s), 3 warning(s)
>>      [java] 0.839131 seconds
>>      [java] Java Result: 255
>>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes
>>     [mkdir] Created dir: /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>>      [java] Loading configuration: /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/compile-config.xml
>>      [java] 
>>      [java] /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/constants/console.as:3
>>      [java] Error: Type was not found or was not a compile-time constant: Console.
>>      [java]     public const console:Console = undefined;
>>      [java]                          ^
>>      [java] 
>>      [java] /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/constants/window.as:3
>>      [java] Error: Type was not found or was not a compile-time constant: Window.
>>      [java]     public const window:Window = undefined;
>>      [java]                         ^
>>      [java] 
>> 
>> BUILD FAILED
>> /Users/harbs/Documents/ApacheFlex/flex-asjs/build.xml:1552: The following error occurred while executing this line:
>> /Users/harbs/Documents/ApacheFlex/flex-asjs/build.xml:1693: The following error occurred while executing this line:
>> /Users/harbs/Documents/ApacheFlex/flex-falcon/build.xml:674: Java returned: 2
>> 
>> On Feb 16, 2016, at 10:36 AM, Harbs <ha...@gmail.com> wrote:
>> 
>>> Thanks for that. I’ll give it a go. If it does not work, I’ll try and figure out why without “complaining” first… ;-)
>>> 
>>> On Feb 16, 2016, at 10:32 AM, Alex Harui <ah...@adobe.com> wrote:
>>> 
>>>> 
>>>> 
>>>> On 2/15/16, 2:38 PM, "Alex Harui" <ah...@adobe.com> wrote:
>>>> 
>>>>> I have not seen anyone offer to make a fix.  I am mostly done with a
>>>>> change. Hopefully it will go in tonight.
>>>>> 
>>>> 
>>>> OK, I pushed changes to flex-falcon and flex-asjs.
>>>> 
>>>> In each of flex-falcon, flex-sdk and flex-asjs, set up an env.properties
>>>> file by copying the env-template.properties file in the root of each repo
>>>> (they are slightly different).
>>>> 
>>>> In each of the env.properties files, I think you only need to set
>>>> AIR_HOME, PLAYERGLOBAL_HOME and FLASHPLAYER_DEBUGGER.  Leave the rest
>>>> commented out.
>>>> 
>>>> Then for me, running "ant all" in flex-asjs, built everything
>>>> successfully.  I'll bet I missed something somewhere, but maybe we'll get
>>>> lucky.
>>>> 
>>>> -Alex
>>>> 
>>> 
>> 
> 


Re: [FALCONJX]Compiling Falcon with externs problems

Posted by Harbs <ha...@gmail.com>.
Renaming this because this has nothing to do with XML.

I’ve been trying various things related to the externs and nothing I’m doing seems to be right.

1. Running it with all my existing externs files causes an error that Window and Console are undefined.
2. Removing the js externs files causes an error because svg.js is missing when the js compile-config file looks for it in line 71.
3. Adding just svg.js back in causes an error on line 56 because the interfaces path is missing (I cleared out the “out” folder thinking it would get regenerated.)

I looked through the build script to try and find where the externs files are supposed to be downloaded, but I could not find it. I’m also having trouble following the order of events in terms of generating the extern-related files.

I’m out of time for this morning. I’ll try again later, but if anyone can give me some pointers, it might help this lost traveler… ;-)

Harbs

On Feb 16, 2016, at 11:14 AM, Harbs <ha...@gmail.com> wrote:

> It looks improved to me. I still needed to add the unittest.properties file, but that’s fine.
> 
> I now seem to be getting stuck on externs. I’m trying to figure out what’s not set up properly on my machine, but if anyone has pointers please pipe up.
> 
> externc.js.swc:
>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>      [java] WARNING: [es6]:87: WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
>      [java] Generator.prototype.return = function(value) {};
>      [java]                     ^
>      [java] 
>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>      [java] WARNING: [es6]:93: WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
>      [java] Generator.prototype.throw = function(exception) {};
>      [java]                     ^
>      [java] 
>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>      [java] WARNING: [es6]:898: WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
>      [java] Promise.prototype.catch = function(onRejected) {};
>      [java]                   ^
>      [java] 
>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>      [java] SEVERE: [missing]:91: ERROR - Parse error. identifier is a reserved word
>      [java] function int() {}
>      [java]          ^
>      [java] 
>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>      [java] SEVERE: [missing]:97: ERROR - Parse error. identifier is a reserved word
>      [java] int.prototype.toString = function(opt_radix) {}
>      [java] ^
>      [java] 
>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager printSummary
>      [java] WARNING: 2 error(s), 3 warning(s)
>      [java] 0.839131 seconds
>      [java] Java Result: 255
>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes
>     [mkdir] Created dir: /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>      [java] Loading configuration: /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/compile-config.xml
>      [java] 
>      [java] /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/constants/console.as:3
>      [java] Error: Type was not found or was not a compile-time constant: Console.
>      [java]     public const console:Console = undefined;
>      [java]                          ^
>      [java] 
>      [java] /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/constants/window.as:3
>      [java] Error: Type was not found or was not a compile-time constant: Window.
>      [java]     public const window:Window = undefined;
>      [java]                         ^
>      [java] 
> 
> BUILD FAILED
> /Users/harbs/Documents/ApacheFlex/flex-asjs/build.xml:1552: The following error occurred while executing this line:
> /Users/harbs/Documents/ApacheFlex/flex-asjs/build.xml:1693: The following error occurred while executing this line:
> /Users/harbs/Documents/ApacheFlex/flex-falcon/build.xml:674: Java returned: 2
> 
> On Feb 16, 2016, at 10:36 AM, Harbs <ha...@gmail.com> wrote:
> 
>> Thanks for that. I’ll give it a go. If it does not work, I’ll try and figure out why without “complaining” first… ;-)
>> 
>> On Feb 16, 2016, at 10:32 AM, Alex Harui <ah...@adobe.com> wrote:
>> 
>>> 
>>> 
>>> On 2/15/16, 2:38 PM, "Alex Harui" <ah...@adobe.com> wrote:
>>> 
>>>> I have not seen anyone offer to make a fix.  I am mostly done with a
>>>> change. Hopefully it will go in tonight.
>>>> 
>>> 
>>> OK, I pushed changes to flex-falcon and flex-asjs.
>>> 
>>> In each of flex-falcon, flex-sdk and flex-asjs, set up an env.properties
>>> file by copying the env-template.properties file in the root of each repo
>>> (they are slightly different).
>>> 
>>> In each of the env.properties files, I think you only need to set
>>> AIR_HOME, PLAYERGLOBAL_HOME and FLASHPLAYER_DEBUGGER.  Leave the rest
>>> commented out.
>>> 
>>> Then for me, running "ant all" in flex-asjs, built everything
>>> successfully.  I'll bet I missed something somewhere, but maybe we'll get
>>> lucky.
>>> 
>>> -Alex
>>> 
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
The error definitely makes sense because I don’t see Window and Console defined anywhere. I’m having trouble finding what created the constant files. I tried removing the externs folder from the js folder in the hope that it would be re-created (hopefully in a better fashion), but I get an error that svg.js cannot be found.

How do I re-download the externs files? I do not remember what I did to have them downloaded originally.

On Feb 16, 2016, at 11:14 AM, Harbs <ha...@gmail.com> wrote:

> It looks improved to me. I still needed to add the unittest.properties file, but that’s fine.
> 
> I now seem to be getting stuck on externs. I’m trying to figure out what’s not set up properly on my machine, but if anyone has pointers please pipe up.
> 
> externc.js.swc:
>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>      [java] WARNING: [es6]:87: WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
>      [java] Generator.prototype.return = function(value) {};
>      [java]                     ^
>      [java] 
>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>      [java] WARNING: [es6]:93: WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
>      [java] Generator.prototype.throw = function(exception) {};
>      [java]                     ^
>      [java] 
>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>      [java] WARNING: [es6]:898: WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
>      [java] Promise.prototype.catch = function(onRejected) {};
>      [java]                   ^
>      [java] 
>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>      [java] SEVERE: [missing]:91: ERROR - Parse error. identifier is a reserved word
>      [java] function int() {}
>      [java]          ^
>      [java] 
>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
>      [java] SEVERE: [missing]:97: ERROR - Parse error. identifier is a reserved word
>      [java] int.prototype.toString = function(opt_radix) {}
>      [java] ^
>      [java] 
>      [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager printSummary
>      [java] WARNING: 2 error(s), 3 warning(s)
>      [java] 0.839131 seconds
>      [java] Java Result: 255
>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes
>     [mkdir] Created dir: /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>      [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
>      [java] Loading configuration: /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/compile-config.xml
>      [java] 
>      [java] /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/constants/console.as:3
>      [java] Error: Type was not found or was not a compile-time constant: Console.
>      [java]     public const console:Console = undefined;
>      [java]                          ^
>      [java] 
>      [java] /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/constants/window.as:3
>      [java] Error: Type was not found or was not a compile-time constant: Window.
>      [java]     public const window:Window = undefined;
>      [java]                         ^
>      [java] 
> 
> BUILD FAILED
> /Users/harbs/Documents/ApacheFlex/flex-asjs/build.xml:1552: The following error occurred while executing this line:
> /Users/harbs/Documents/ApacheFlex/flex-asjs/build.xml:1693: The following error occurred while executing this line:
> /Users/harbs/Documents/ApacheFlex/flex-falcon/build.xml:674: Java returned: 2
> 
> On Feb 16, 2016, at 10:36 AM, Harbs <ha...@gmail.com> wrote:
> 
>> Thanks for that. I’ll give it a go. If it does not work, I’ll try and figure out why without “complaining” first… ;-)
>> 
>> On Feb 16, 2016, at 10:32 AM, Alex Harui <ah...@adobe.com> wrote:
>> 
>>> 
>>> 
>>> On 2/15/16, 2:38 PM, "Alex Harui" <ah...@adobe.com> wrote:
>>> 
>>>> I have not seen anyone offer to make a fix.  I am mostly done with a
>>>> change. Hopefully it will go in tonight.
>>>> 
>>> 
>>> OK, I pushed changes to flex-falcon and flex-asjs.
>>> 
>>> In each of flex-falcon, flex-sdk and flex-asjs, set up an env.properties
>>> file by copying the env-template.properties file in the root of each repo
>>> (they are slightly different).
>>> 
>>> In each of the env.properties files, I think you only need to set
>>> AIR_HOME, PLAYERGLOBAL_HOME and FLASHPLAYER_DEBUGGER.  Leave the rest
>>> commented out.
>>> 
>>> Then for me, running "ant all" in flex-asjs, built everything
>>> successfully.  I'll bet I missed something somewhere, but maybe we'll get
>>> lucky.
>>> 
>>> -Alex
>>> 
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
It looks improved to me. I still needed to add the unittest.properties file, but that’s fine.

I now seem to be getting stuck on externs. I’m trying to figure out what’s not set up properly on my machine, but if anyone has pointers please pipe up.

externc.js.swc:
     [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
     [java] WARNING: [es6]:87: WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
     [java] Generator.prototype.return = function(value) {};
     [java]                     ^
     [java] 
     [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
     [java] WARNING: [es6]:93: WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
     [java] Generator.prototype.throw = function(exception) {};
     [java]                     ^
     [java] 
     [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
     [java] WARNING: [es6]:898: WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
     [java] Promise.prototype.catch = function(onRejected) {};
     [java]                   ^
     [java] 
     [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
     [java] SEVERE: [missing]:91: ERROR - Parse error. identifier is a reserved word
     [java] function int() {}
     [java]          ^
     [java] 
     [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager println
     [java] SEVERE: [missing]:97: ERROR - Parse error. identifier is a reserved word
     [java] int.prototype.toString = function(opt_radix) {}
     [java] ^
     [java] 
     [java] Feb 16, 2016 11:05:24 AM com.google.javascript.jscomp.LoggerErrorManager printSummary
     [java] WARNING: 2 error(s), 3 warning(s)
     [java] 0.839131 seconds
     [java] Java Result: 255
     [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes
    [mkdir] Created dir: /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
     [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
     [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
     [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
     [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
     [copy] Copying 1 file to /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/classes/__AS3__/vec
     [java] Loading configuration: /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/compile-config.xml
     [java] 
     [java] /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/constants/console.as:3
     [java] Error: Type was not found or was not a compile-time constant: Console.
     [java]     public const console:Console = undefined;
     [java]                          ^
     [java] 
     [java] /Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/as/constants/window.as:3
     [java] Error: Type was not found or was not a compile-time constant: Window.
     [java]     public const window:Window = undefined;
     [java]                         ^
     [java] 

BUILD FAILED
/Users/harbs/Documents/ApacheFlex/flex-asjs/build.xml:1552: The following error occurred while executing this line:
/Users/harbs/Documents/ApacheFlex/flex-asjs/build.xml:1693: The following error occurred while executing this line:
/Users/harbs/Documents/ApacheFlex/flex-falcon/build.xml:674: Java returned: 2

On Feb 16, 2016, at 10:36 AM, Harbs <ha...@gmail.com> wrote:

> Thanks for that. I’ll give it a go. If it does not work, I’ll try and figure out why without “complaining” first… ;-)
> 
> On Feb 16, 2016, at 10:32 AM, Alex Harui <ah...@adobe.com> wrote:
> 
>> 
>> 
>> On 2/15/16, 2:38 PM, "Alex Harui" <ah...@adobe.com> wrote:
>> 
>>> I have not seen anyone offer to make a fix.  I am mostly done with a
>>> change. Hopefully it will go in tonight.
>>> 
>> 
>> OK, I pushed changes to flex-falcon and flex-asjs.
>> 
>> In each of flex-falcon, flex-sdk and flex-asjs, set up an env.properties
>> file by copying the env-template.properties file in the root of each repo
>> (they are slightly different).
>> 
>> In each of the env.properties files, I think you only need to set
>> AIR_HOME, PLAYERGLOBAL_HOME and FLASHPLAYER_DEBUGGER.  Leave the rest
>> commented out.
>> 
>> Then for me, running "ant all" in flex-asjs, built everything
>> successfully.  I'll bet I missed something somewhere, but maybe we'll get
>> lucky.
>> 
>> -Alex
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Thanks for that. I’ll give it a go. If it does not work, I’ll try and figure out why without “complaining” first… ;-)

On Feb 16, 2016, at 10:32 AM, Alex Harui <ah...@adobe.com> wrote:

> 
> 
> On 2/15/16, 2:38 PM, "Alex Harui" <ah...@adobe.com> wrote:
> 
>> I have not seen anyone offer to make a fix.  I am mostly done with a
>> change. Hopefully it will go in tonight.
>> 
> 
> OK, I pushed changes to flex-falcon and flex-asjs.
> 
> In each of flex-falcon, flex-sdk and flex-asjs, set up an env.properties
> file by copying the env-template.properties file in the root of each repo
> (they are slightly different).
> 
> In each of the env.properties files, I think you only need to set
> AIR_HOME, PLAYERGLOBAL_HOME and FLASHPLAYER_DEBUGGER.  Leave the rest
> commented out.
> 
> Then for me, running "ant all" in flex-asjs, built everything
> successfully.  I'll bet I missed something somewhere, but maybe we'll get
> lucky.
> 
> -Alex
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Josh Tynjala <jo...@gmail.com>.
Thank you, Alex. I am able to build flex-falcon successfully using only
env.properties. I was able to remove the unittest.properties files, and my
env.properties file now only defines these three values: env.AIR_HOME,
env.FLASHPLAYER_DEBUGGER, and env.PLAYERGLOBAL_HOME.

This is an Ant build that pretty much anyone should be able to get up and
running easily using either env.properties or real environment variables.
Thank you for your efforts. I know it's not fun work, but you've put us in
a good place for new contributors.

- Josh

On Tue, Feb 16, 2016 at 1:32 AM, Alex Harui <ah...@adobe.com> wrote:

>
> In each of the env.properties files, I think you only need to set
> AIR_HOME, PLAYERGLOBAL_HOME and FLASHPLAYER_DEBUGGER.  Leave the rest
> commented out.
>

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 2/15/16, 2:38 PM, "Alex Harui" <ah...@adobe.com> wrote:

>I have not seen anyone offer to make a fix.  I am mostly done with a
>change. Hopefully it will go in tonight.
>

OK, I pushed changes to flex-falcon and flex-asjs.

In each of flex-falcon, flex-sdk and flex-asjs, set up an env.properties
file by copying the env-template.properties file in the root of each repo
(they are slightly different).

In each of the env.properties files, I think you only need to set
AIR_HOME, PLAYERGLOBAL_HOME and FLASHPLAYER_DEBUGGER.  Leave the rest
commented out.

Then for me, running "ant all" in flex-asjs, built everything
successfully.  I'll bet I missed something somewhere, but maybe we'll get
lucky.

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Alex Harui <ah...@adobe.com>.
I have not seen anyone offer to make a fix.  I am mostly done with a change. Hopefully it will go in tonight.


Sent from my LG G3, an AT&T 4G LTE smartphone


------ Original message------

From: OmPrakash Muppirala

Date: Mon, Feb 15, 2016 1:55 PM

To: dev@flex.apache.org;

Subject:Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)


Alex,

The way I am reading this thread, I don't think folks are asking you to
make the changes.  They are generally asking if it is okay to make these
kind of changes.  It would be good if you are okay with the changes since
you are one of the affected parties.

Thanks,
Om

On Mon, Feb 15, 2016 at 1:36 PM, Alex Harui <ah...@adobe.com> wrote:

>
>
> On 2/15/16, 1:32 PM, "Michael Schmalle" <te...@gmail.com> wrote:
>
> >Alex, if I had time I wouldn't do it. :) I hate build stuff and this is
> >exactly why I set that template file up.
>
> Well, I'm glad it worked for you, and it worked for me, but now I am
> spending time trying to implement something else to make others happy.
> Yes, we want to make it easier for others to contribute, but I don't like
> it that it always falls on me to try to figure it out for others.
>
> -Alex
>
>

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by OmPrakash Muppirala <bi...@gmail.com>.
Alex,

The way I am reading this thread, I don't think folks are asking you to
make the changes.  They are generally asking if it is okay to make these
kind of changes.  It would be good if you are okay with the changes since
you are one of the affected parties.

Thanks,
Om

On Mon, Feb 15, 2016 at 1:36 PM, Alex Harui <ah...@adobe.com> wrote:

>
>
> On 2/15/16, 1:32 PM, "Michael Schmalle" <te...@gmail.com> wrote:
>
> >Alex, if I had time I wouldn't do it. :) I hate build stuff and this is
> >exactly why I set that template file up.
>
> Well, I'm glad it worked for you, and it worked for me, but now I am
> spending time trying to implement something else to make others happy.
> Yes, we want to make it easier for others to contribute, but I don't like
> it that it always falls on me to try to figure it out for others.
>
> -Alex
>
>

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 2/15/16, 1:54 PM, "Michael Schmalle" <te...@gmail.com> wrote:

>On Mon, Feb 15, 2016 at 4:36 PM, Alex Harui <ah...@adobe.com> wrote:
>
>>
>>
>> On 2/15/16, 1:32 PM, "Michael Schmalle" <te...@gmail.com>
>>wrote:
>>
>> >Alex, if I had time I wouldn't do it. :) I hate build stuff and this is
>> >exactly why I set that template file up.
>>
>> Well, I'm glad it worked for you, and it worked for me, but now I am
>> spending time trying to implement something else to make others happy.
>> Yes, we want to make it easier for others to contribute, but I don't
>>like
>> it that it always falls on me to try to figure it out for others.
>>
>
>Seriously I don't understand, I worked on it off and on for 1.5 years and
>came back 2 years later and got it to work the first time. So is it really
>broken?

It isn't broken, it is too difficult for folks to figure out who don't
want to dig into the compiler.

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Michael Schmalle <te...@gmail.com>.
On Mon, Feb 15, 2016 at 4:36 PM, Alex Harui <ah...@adobe.com> wrote:

>
>
> On 2/15/16, 1:32 PM, "Michael Schmalle" <te...@gmail.com> wrote:
>
> >Alex, if I had time I wouldn't do it. :) I hate build stuff and this is
> >exactly why I set that template file up.
>
> Well, I'm glad it worked for you, and it worked for me, but now I am
> spending time trying to implement something else to make others happy.
> Yes, we want to make it easier for others to contribute, but I don't like
> it that it always falls on me to try to figure it out for others.
>

Seriously I don't understand, I worked on it off and on for 1.5 years and
came back 2 years later and got it to work the first time. So is it really
broken?

I was only trying to add humor to your situation which I get. I have 2-3
weeks before the uploads to google play start with my audio stuff. After
that if I get some monetary stuff coming in, I can finally start to venture
out into more experimental directions and I was investigating Cordova as we
talked before.

Although, if I get more time this next 2-3 months, I am no good at these
massive build targets.

Mike



>
> -Alex
>
>

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 2/15/16, 1:32 PM, "Michael Schmalle" <te...@gmail.com> wrote:

>Alex, if I had time I wouldn't do it. :) I hate build stuff and this is
>exactly why I set that template file up.

Well, I'm glad it worked for you, and it worked for me, but now I am
spending time trying to implement something else to make others happy.
Yes, we want to make it easier for others to contribute, but I don't like
it that it always falls on me to try to figure it out for others.

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Michael Schmalle <te...@gmail.com>.
Alex, if I had time I wouldn't do it. :) I hate build stuff and this is
exactly why I set that template file up.

I have never had a problem getting things going, so people that are having
problems are missing a step or two.

It seems like a youtube video showing exactly the steps would help hehehe.
;-)

Mike

On Mon, Feb 15, 2016 at 4:20 PM, Alex Harui <ah...@adobe.com> wrote:

> And there is a template-unittest.properties file in compiler.tests which
> explains the options.
>
> The README supposedly contains sufficient information to build from
> sources since several PMC members have successfully done so and voted to
> release.
>
> I don't know how much time to devote to make the build system simpler.
> Some place have full time build engineers.  Should I become a full-time
> build engineer and stop developing features?  Everyone has their favorite
> way of configuring their system.  I am not enjoying trying to guess what
> people want to do.  This is not my itch that I want to scratch, but
> apparently, nobody else has the time to make it better.  They just want to
> complain.  I've been using scripts that set environment variables for
> years.  It seems to work for me.
>
> I will try to get the build system to read an env.properties file from a
> repo root.  I don't think we can have an uber env.properties.  We can't
> guarantee all repos will stay in sync.
>
> -Alex
>
> On 2/15/16, 9:16 AM, "Josh Tynjala" <jo...@gmail.com> wrote:
>
> >I think I found that you need to add unittest.properties in both compiler
> >and compiler.jx. The readme file has details about what properties should
> >be defined. It's near the bottom, as I recall, which means it's easy to
> >miss.
> >
> >I agree with Harbs that we should probably make this simpler. Instead of a
> >separate properties file for tests, why not use env.properties?
> >
> >- Josh
> >On Feb 15, 2016 8:01 AM, "Harbs" <ha...@gmail.com> wrote:
> >
> >> Where do I need to set the unittest.properties file?
> >>
> >> I’m happy to do so, but I think it would be great if we could at least
> >>get
> >> some instructions on everything needed to build from source.
> >>
> >> Every time I come back to this, I have trouble. Maybe it’s just me, but
> >>it
> >> seems like it raises the bar needed to contribute.
> >>
> >> On Feb 15, 2016, at 5:01 PM, Alex Harui <ah...@adobe.com> wrote:
> >>
> >> >
> >> >
> >> > On 2/14/16, 11:52 PM, "Harbs" <ha...@gmail.com> wrote:
> >> >
> >> >> Cleaning the repo seemed to have helped somewhat, but I still could
> >>not
> >> >> compile, and I’m assuming because I need to build falcon:
> >> >> Buildfile:
> >> >>
> >>
> >>/Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/build
> >>.
> >> >> xml
> >> >>
> >> >> clean:
> >> >>
> >> >> check-falcon-home:
> >> >>    [echo] FALCON_HOME is
> >> >> /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler
> >> >>
> >> >> check-falconjx-home:
> >> >>    [echo] FALCONJX_HOME is
> >> >> /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler.jx
> >> >
> >> > This implies you still have environment variables set somehow.  The
> >> > defaults would use relative paths with ../ in them.
> >> > Do you have an env.properties file or local.properties file?
> >> >
> >> >
> >> >>
> >> >> unit.tests:
> >> >>   [junit] unittest.properties not found
> >> >>   [junit] environment property - FLEX_HOME =
> >> >>
> >>
> >>/Users/harbs/Documents/ApacheFlex/flex-falcon/compiler/generated/dist/sdk
> >> >>   [junit] environment property - PLAYERGLOBAL_HOME =
> >> >>
> >>
> >>/Users/harbs/Documents/ApacheFlex/flex-falcon/compiler/generated/dist/sdk
> >>/
> >> >> frameworks/libs/player
> >> >>   [junit] environment property - PLAYERGLOBAL_VERSION = 11.1
> >> >>   [junit] environment property - TLF_HOME = null
> >> >>   [junit] environment property - AIR_HOME = null
> >> >>   [junit] environment property - FLASHPLAYER_DEBUGGER = null
> >> >
> >> > I will spend time today trying to get the build to work without
> >> > unittest.properties files, but I think it will still require setting
> >> > PLAYERGLOBAL_HOME, AIR_HOME, FLASHPLAYER_DEBUGGER and maybe
> >> > PLAYERGLOBAL_VERSION in the environment.  I have spent several hours
> >> > already trying to make sure folks don't have to specify relative
> >>paths to
> >> > other Apache Flex repos, but right now we don't have a good way to
> >>guess
> >> > where folks put the Adobe stuff.
> >> >
> >> > -Alex
> >>
> >>
>
>

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Michael Schmalle <te...@gmail.com>.
This all came back to the beginning. The tests(Falcon, etal) were a
nightmare, I'm talking 2012.

When I started writing the FalconJX compiler and created falcon.jx and
falcon.jx.tests Eclipse projects, I needed something that worked, so I
created the template file so it would work in the two projects I was
developing. I didn't need to run the falcon tests all the time.

Anyway, it's just one of those legacy hacks that can be corrected by
somebody that knows how to fix it. :)

Mike

On Mon, Feb 15, 2016 at 12:16 PM, Josh Tynjala <jo...@gmail.com>
wrote:

> I think I found that you need to add unittest.properties in both compiler
> and compiler.jx. The readme file has details about what properties should
> be defined. It's near the bottom, as I recall, which means it's easy to
> miss.
>
> I agree with Harbs that we should probably make this simpler. Instead of a
> separate properties file for tests, why not use env.properties?
>
> - Josh
> On Feb 15, 2016 8:01 AM, "Harbs" <ha...@gmail.com> wrote:
>
> > Where do I need to set the unittest.properties file?
> >
> > I’m happy to do so, but I think it would be great if we could at least
> get
> > some instructions on everything needed to build from source.
> >
> > Every time I come back to this, I have trouble. Maybe it’s just me, but
> it
> > seems like it raises the bar needed to contribute.
> >
> > On Feb 15, 2016, at 5:01 PM, Alex Harui <ah...@adobe.com> wrote:
> >
> > >
> > >
> > > On 2/14/16, 11:52 PM, "Harbs" <ha...@gmail.com> wrote:
> > >
> > >> Cleaning the repo seemed to have helped somewhat, but I still could
> not
> > >> compile, and I’m assuming because I need to build falcon:
> > >> Buildfile:
> > >>
> >
> /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/build.
> > >> xml
> > >>
> > >> clean:
> > >>
> > >> check-falcon-home:
> > >>    [echo] FALCON_HOME is
> > >> /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler
> > >>
> > >> check-falconjx-home:
> > >>    [echo] FALCONJX_HOME is
> > >> /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler.jx
> > >
> > > This implies you still have environment variables set somehow.  The
> > > defaults would use relative paths with ../ in them.
> > > Do you have an env.properties file or local.properties file?
> > >
> > >
> > >>
> > >> unit.tests:
> > >>   [junit] unittest.properties not found
> > >>   [junit] environment property - FLEX_HOME =
> > >>
> > /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler/generated/dist/sdk
> > >>   [junit] environment property - PLAYERGLOBAL_HOME =
> > >>
> >
> /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler/generated/dist/sdk/
> > >> frameworks/libs/player
> > >>   [junit] environment property - PLAYERGLOBAL_VERSION = 11.1
> > >>   [junit] environment property - TLF_HOME = null
> > >>   [junit] environment property - AIR_HOME = null
> > >>   [junit] environment property - FLASHPLAYER_DEBUGGER = null
> > >
> > > I will spend time today trying to get the build to work without
> > > unittest.properties files, but I think it will still require setting
> > > PLAYERGLOBAL_HOME, AIR_HOME, FLASHPLAYER_DEBUGGER and maybe
> > > PLAYERGLOBAL_VERSION in the environment.  I have spent several hours
> > > already trying to make sure folks don't have to specify relative paths
> to
> > > other Apache Flex repos, but right now we don't have a good way to
> guess
> > > where folks put the Adobe stuff.
> > >
> > > -Alex
> >
> >
>

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Alex Harui <ah...@adobe.com>.
And there is a template-unittest.properties file in compiler.tests which
explains the options.

The README supposedly contains sufficient information to build from
sources since several PMC members have successfully done so and voted to
release.

I don't know how much time to devote to make the build system simpler.
Some place have full time build engineers.  Should I become a full-time
build engineer and stop developing features?  Everyone has their favorite
way of configuring their system.  I am not enjoying trying to guess what
people want to do.  This is not my itch that I want to scratch, but
apparently, nobody else has the time to make it better.  They just want to
complain.  I've been using scripts that set environment variables for
years.  It seems to work for me.

I will try to get the build system to read an env.properties file from a
repo root.  I don't think we can have an uber env.properties.  We can't
guarantee all repos will stay in sync.

-Alex

On 2/15/16, 9:16 AM, "Josh Tynjala" <jo...@gmail.com> wrote:

>I think I found that you need to add unittest.properties in both compiler
>and compiler.jx. The readme file has details about what properties should
>be defined. It's near the bottom, as I recall, which means it's easy to
>miss.
>
>I agree with Harbs that we should probably make this simpler. Instead of a
>separate properties file for tests, why not use env.properties?
>
>- Josh
>On Feb 15, 2016 8:01 AM, "Harbs" <ha...@gmail.com> wrote:
>
>> Where do I need to set the unittest.properties file?
>>
>> I’m happy to do so, but I think it would be great if we could at least
>>get
>> some instructions on everything needed to build from source.
>>
>> Every time I come back to this, I have trouble. Maybe it’s just me, but
>>it
>> seems like it raises the bar needed to contribute.
>>
>> On Feb 15, 2016, at 5:01 PM, Alex Harui <ah...@adobe.com> wrote:
>>
>> >
>> >
>> > On 2/14/16, 11:52 PM, "Harbs" <ha...@gmail.com> wrote:
>> >
>> >> Cleaning the repo seemed to have helped somewhat, but I still could
>>not
>> >> compile, and I’m assuming because I need to build falcon:
>> >> Buildfile:
>> >>
>> 
>>/Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/build
>>.
>> >> xml
>> >>
>> >> clean:
>> >>
>> >> check-falcon-home:
>> >>    [echo] FALCON_HOME is
>> >> /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler
>> >>
>> >> check-falconjx-home:
>> >>    [echo] FALCONJX_HOME is
>> >> /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler.jx
>> >
>> > This implies you still have environment variables set somehow.  The
>> > defaults would use relative paths with ../ in them.
>> > Do you have an env.properties file or local.properties file?
>> >
>> >
>> >>
>> >> unit.tests:
>> >>   [junit] unittest.properties not found
>> >>   [junit] environment property - FLEX_HOME =
>> >>
>> 
>>/Users/harbs/Documents/ApacheFlex/flex-falcon/compiler/generated/dist/sdk
>> >>   [junit] environment property - PLAYERGLOBAL_HOME =
>> >>
>> 
>>/Users/harbs/Documents/ApacheFlex/flex-falcon/compiler/generated/dist/sdk
>>/
>> >> frameworks/libs/player
>> >>   [junit] environment property - PLAYERGLOBAL_VERSION = 11.1
>> >>   [junit] environment property - TLF_HOME = null
>> >>   [junit] environment property - AIR_HOME = null
>> >>   [junit] environment property - FLASHPLAYER_DEBUGGER = null
>> >
>> > I will spend time today trying to get the build to work without
>> > unittest.properties files, but I think it will still require setting
>> > PLAYERGLOBAL_HOME, AIR_HOME, FLASHPLAYER_DEBUGGER and maybe
>> > PLAYERGLOBAL_VERSION in the environment.  I have spent several hours
>> > already trying to make sure folks don't have to specify relative
>>paths to
>> > other Apache Flex repos, but right now we don't have a good way to
>>guess
>> > where folks put the Adobe stuff.
>> >
>> > -Alex
>>
>>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Josh Tynjala <jo...@gmail.com>.
I think I found that you need to add unittest.properties in both compiler
and compiler.jx. The readme file has details about what properties should
be defined. It's near the bottom, as I recall, which means it's easy to
miss.

I agree with Harbs that we should probably make this simpler. Instead of a
separate properties file for tests, why not use env.properties?

- Josh
On Feb 15, 2016 8:01 AM, "Harbs" <ha...@gmail.com> wrote:

> Where do I need to set the unittest.properties file?
>
> I’m happy to do so, but I think it would be great if we could at least get
> some instructions on everything needed to build from source.
>
> Every time I come back to this, I have trouble. Maybe it’s just me, but it
> seems like it raises the bar needed to contribute.
>
> On Feb 15, 2016, at 5:01 PM, Alex Harui <ah...@adobe.com> wrote:
>
> >
> >
> > On 2/14/16, 11:52 PM, "Harbs" <ha...@gmail.com> wrote:
> >
> >> Cleaning the repo seemed to have helped somewhat, but I still could not
> >> compile, and I’m assuming because I need to build falcon:
> >> Buildfile:
> >>
> /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/build.
> >> xml
> >>
> >> clean:
> >>
> >> check-falcon-home:
> >>    [echo] FALCON_HOME is
> >> /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler
> >>
> >> check-falconjx-home:
> >>    [echo] FALCONJX_HOME is
> >> /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler.jx
> >
> > This implies you still have environment variables set somehow.  The
> > defaults would use relative paths with ../ in them.
> > Do you have an env.properties file or local.properties file?
> >
> >
> >>
> >> unit.tests:
> >>   [junit] unittest.properties not found
> >>   [junit] environment property - FLEX_HOME =
> >>
> /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler/generated/dist/sdk
> >>   [junit] environment property - PLAYERGLOBAL_HOME =
> >>
> /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler/generated/dist/sdk/
> >> frameworks/libs/player
> >>   [junit] environment property - PLAYERGLOBAL_VERSION = 11.1
> >>   [junit] environment property - TLF_HOME = null
> >>   [junit] environment property - AIR_HOME = null
> >>   [junit] environment property - FLASHPLAYER_DEBUGGER = null
> >
> > I will spend time today trying to get the build to work without
> > unittest.properties files, but I think it will still require setting
> > PLAYERGLOBAL_HOME, AIR_HOME, FLASHPLAYER_DEBUGGER and maybe
> > PLAYERGLOBAL_VERSION in the environment.  I have spent several hours
> > already trying to make sure folks don't have to specify relative paths to
> > other Apache Flex repos, but right now we don't have a good way to guess
> > where folks put the Adobe stuff.
> >
> > -Alex
>
>

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Where do I need to set the unittest.properties file?

I’m happy to do so, but I think it would be great if we could at least get some instructions on everything needed to build from source.

Every time I come back to this, I have trouble. Maybe it’s just me, but it seems like it raises the bar needed to contribute.

On Feb 15, 2016, at 5:01 PM, Alex Harui <ah...@adobe.com> wrote:

> 
> 
> On 2/14/16, 11:52 PM, "Harbs" <ha...@gmail.com> wrote:
> 
>> Cleaning the repo seemed to have helped somewhat, but I still could not
>> compile, and I’m assuming because I need to build falcon:
>> Buildfile: 
>> /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/build.
>> xml
>> 
>> clean:
>> 
>> check-falcon-home:
>>    [echo] FALCON_HOME is
>> /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler
>> 
>> check-falconjx-home:
>>    [echo] FALCONJX_HOME is
>> /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler.jx
> 
> This implies you still have environment variables set somehow.  The
> defaults would use relative paths with ../ in them.
> Do you have an env.properties file or local.properties file?
> 
> 
>> 
>> unit.tests:
>>   [junit] unittest.properties not found
>>   [junit] environment property - FLEX_HOME =
>> /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler/generated/dist/sdk
>>   [junit] environment property - PLAYERGLOBAL_HOME =
>> /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler/generated/dist/sdk/
>> frameworks/libs/player
>>   [junit] environment property - PLAYERGLOBAL_VERSION = 11.1
>>   [junit] environment property - TLF_HOME = null
>>   [junit] environment property - AIR_HOME = null
>>   [junit] environment property - FLASHPLAYER_DEBUGGER = null
> 
> I will spend time today trying to get the build to work without
> unittest.properties files, but I think it will still require setting
> PLAYERGLOBAL_HOME, AIR_HOME, FLASHPLAYER_DEBUGGER and maybe
> PLAYERGLOBAL_VERSION in the environment.  I have spent several hours
> already trying to make sure folks don't have to specify relative paths to
> other Apache Flex repos, but right now we don't have a good way to guess
> where folks put the Adobe stuff.
> 
> -Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
I would vote to have a single file which contains settings for all environment variables for all projects.

Can we adjust ALL the builds in all projects to look in ../properties/env.properties for environment variables? (i.e. in a folder on the same level as the repo)

It would require manually adding a properties file, but it would have the advantage of:
1) Being outside all the repos, so deleting and checking out the repos will have no effect on this.
2) A single file can be used for all projects
3) It will make it very clear what variables need to be set and where to set them.

On Feb 15, 2016, at 5:01 PM, Alex Harui <ah...@adobe.com> wrote:

> I will spend time today trying to get the build to work without
> unittest.properties files, but I think it will still require setting
> PLAYERGLOBAL_HOME, AIR_HOME, FLASHPLAYER_DEBUGGER and maybe
> PLAYERGLOBAL_VERSION in the environment.


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 2/14/16, 11:52 PM, "Harbs" <ha...@gmail.com> wrote:

>Cleaning the repo seemed to have helped somewhat, but I still could not
>compile, and I’m assuming because I need to build falcon:
>Buildfile: 
>/Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/build.
>xml
>
>clean:
>
>check-falcon-home:
>     [echo] FALCON_HOME is
>/Users/harbs/Documents/ApacheFlex/flex-falcon/compiler
>
>check-falconjx-home:
>     [echo] FALCONJX_HOME is
>/Users/harbs/Documents/ApacheFlex/flex-falcon/compiler.jx

This implies you still have environment variables set somehow.  The
defaults would use relative paths with ../ in them.
Do you have an env.properties file or local.properties file?


>
>unit.tests:
>    [junit] unittest.properties not found
>    [junit] environment property - FLEX_HOME =
>/Users/harbs/Documents/ApacheFlex/flex-falcon/compiler/generated/dist/sdk
>    [junit] environment property - PLAYERGLOBAL_HOME =
>/Users/harbs/Documents/ApacheFlex/flex-falcon/compiler/generated/dist/sdk/
>frameworks/libs/player
>    [junit] environment property - PLAYERGLOBAL_VERSION = 11.1
>    [junit] environment property - TLF_HOME = null
>    [junit] environment property - AIR_HOME = null
>    [junit] environment property - FLASHPLAYER_DEBUGGER = null

I will spend time today trying to get the build to work without
unittest.properties files, but I think it will still require setting
PLAYERGLOBAL_HOME, AIR_HOME, FLASHPLAYER_DEBUGGER and maybe
PLAYERGLOBAL_VERSION in the environment.  I have spent several hours
already trying to make sure folks don't have to specify relative paths to
other Apache Flex repos, but right now we don't have a good way to guess
where folks put the Adobe stuff.

-Alex



Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Cleaning the repo seemed to have helped somewhat, but I still could not compile, and I’m assuming because I need to build falcon:
Buildfile: /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/build.xml

clean:

check-falcon-home:
     [echo] FALCON_HOME is /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler

check-falconjx-home:
     [echo] FALCONJX_HOME is /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler.jx
[available] DEPRECATED - <available> used to override an existing property.
[available]   Build file should not reuse the same property name for different values.

more-props:

compile-asjs:
     [echo] Cross-compiling XML-0.6.0.swc
     [echo] FALCONJX_HOME: /Users/harbs/Documents/ApacheFlex/flex-asjs/../flex-falcon/compiler.jx
     [java] /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/src/main/resources/compile-asjs-config.xml:49
     [java] unable to open '/Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/externs/Core.swc'.
     [java] /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/src/main/resources/compile-asjs-config.xml (line: 49)
     [java]         </library-path>
     [java] 
     [java] 
     [java] command line
     [java] unable to open '/Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/bin/js.swc'.
     [java] 
     [java] 
     [java] command line
     [java] unable to open '/Users/harbs/Documents/ApacheFlex/flex-falcon/externs/GCL/out/bin/GCL.swc'.
     [java] 
     [java] 
     [java] Java Result: 5

compile-extern-swc:
     [echo] Compiling target/externs/XML-0.6.0.swc
     [echo] FLEX_HOME: /Users/harbs/Documents/ApacheFlex/flex-asjs
     [echo] FALCON_HOME: /Users/harbs/Documents/ApacheFlex/flex-asjs/../flex-falcon/compiler/generated/dist/sdk
    [compc] Loading configuration: /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/src/main/resources/compile-asjs-config.xml
    [compc] 
    [compc] /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/src/main/resources/compile-asjs-config.xml:49
    [compc] Error: unable to open '/Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/externs/Core.swc'.
    [compc] /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/src/main/resources/compile-asjs-config.xml (line: 49)
    [compc]         </library-path>
    [compc] 
    [compc] 
    [compc] command line
    [compc] Error: unable to open '/Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/bin/js.swc'.
    [compc] 
    [compc] 
    [compc] command line
    [compc] Error: unable to open '/Users/harbs/Documents/ApacheFlex/flex-falcon/externs/GCL/out/bin/GCL.swc'.
    [compc] 
    [compc] 

I tried to do that, and I get the following error (I removed my env.properties file):

Harbss-MacBook-Pro:flex-falcon harbs$ ant
Buildfile: /Users/harbs/Documents/ApacheFlex/flex-falcon/build.xml

sdk:

download:

prepare:
     [echo] Making lib directory /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler/lib

all:

check-dependency:

download-dependency:

check-dependency:

download-dependency:
     [copy] Warning: /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler/in/temp/commons-cli-1.2 does not exist.

check-dependency:

download-dependency:
     [copy] Warning: /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler/in/temp/commons-io-2.4 does not exist.

check-dependency:

download-dependency:

check-dependency:

download-dependency:
     [copy] Warning: /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler/in/temp does not exist.

check-dependency:

download-dependency:
     [copy] Warning: /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler/in/temp/jflex-1.6.0 does not exist.

check-dependency:

download-dependency:

check-dependency:

download-dependency:

main:

setup:

set.raw.as.tokenizer.uptodate:

raw.as.tokenizer:

set.raw.asdoc.tokenizer.uptodate:

raw.asdoc.tokenizer:

set.raw.mxml.tokenizer.uptodate:

raw.mxml.tokenizer:

jflex:

annotate.class:

set.as.parser.uptodate:

as.parser:

set.metadata.parser.uptodate:

metadata.parser:

set.css.lexer.and.parser.uptodate:

css.lexer.and.parser:

set.css.tree.uptodate:

css.tree:

antlr:

node.adapter:

unknown.tree.pattern.input.output:

set.unknown.tree.handler.patterns.uptodate:

unknown.tree.handler.patterns:

set.cmc.emitter.uptodate:

cmc.emitter:

set.css.emitter.uptodate:

css.emitter:

jburg:

eclipse:

src.depend:

compile:

problem.localizer:

set.messages.en.uptodate:

localization:

version-info:

set.compiler.jar.uptodate:

compiler.jar:

set.falcon.asc.jar.uptodate:

falcon.asc.jar:

set.falcon.mxmlc.jar.uptodate:

falcon.mxmlc.jar:

set.falcon.compc.jar.uptodate:

falcon.compc.jar:

set.falcon.optimizer.jar.uptodate:

falcon.optimizer.jar:

set.falcon.swfdump.jar.uptodate:

falcon.swfdump.jar:

set.falcon.flextasks.jar.uptodate:

falcon.flextasks.jar:

jar:

dist-dev:

sdk:

javadoc:

tests:

download:

prepare:

junit-jar-check:

junit-jar:

main:

compile.unit.tests:
   [delete] Deleting directory /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler.tests/classes
    [mkdir] Created dir: /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler.tests/classes
    [javac] Compiling 67 source files to /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler.tests/classes

unit.tests:
    [junit] unittest.properties not found
    [junit] environment property - FLEX_HOME = /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler/generated/dist/sdk
    [junit] environment property - PLAYERGLOBAL_HOME = /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler/generated/dist/sdk/frameworks/libs/player
    [junit] environment property - PLAYERGLOBAL_VERSION = 11.1
    [junit] environment property - TLF_HOME = null
    [junit] environment property - AIR_HOME = null
    [junit] environment property - FLASHPLAYER_DEBUGGER = null
    [junit] Running org.apache.flex.compiler.internal.css.CSSArrayPropertyValueTests
    [junit] /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler.tests/temp/CSSArrayPropertyValueTests1302202013659801041.mxml(0): This tag could not be resolved to an ActionScript class. It will be ignored.
    [junit] /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler.tests/temp/CSSArrayPropertyValueTests6113005395456480931.mxml(0): This tag could not be resolved to an ActionScript class. It will be ignored.
    [junit] Tests run: 2, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.694 sec

BUILD FAILED
/Users/harbs/Documents/ApacheFlex/flex-falcon/build.xml:82: The following error occurred while executing this line:
/Users/harbs/Documents/ApacheFlex/flex-falcon/compiler.tests/build.xml:103: Tests failed

On Feb 15, 2016, at 8:47 AM, Harbs <ha...@gmail.com> wrote:

> OK. I’ll try to clean my repos and try again.
> 
> On Feb 15, 2016, at 8:30 AM, Alex Harui <ah...@adobe.com> wrote:
> 
>> 
>> 
>> On 2/14/16, 7:51 AM, "Harbs" <ha...@gmail.com> wrote:
>> 
>>> The main build.xml is not working either. I can’t seem to get anything to
>>> build.
>>> 
>>> I just checked out the latest source from all repos.
>>> 
>>> When I try to build falcon, I get an error in junit. It cannot seem to
>>> find TLF_HOME, AIR_HOME or FLASHPLAYER_DEBUGGER.
>> 
>> Please post console output somewhere.  In theory the default build should
>> not need TLF_HOME.
>> 
>>> 
>>> When trying to build flex-asjs, I get the error that it can’t get
>>> https://search.maven.org/remotecontent?filepath=/org/apache/flex/flex-tool
>>> -api/1.0.0/flex-tool-api-1.0.0.jar
>> 
>> This implies your flex-sdk is not in sync.  Change
>> d103170c3246e34dabea342ec6d70d32c53017a7 removed the slash before the
>> "org".
>> 
>> 
>>> 
>>> When trying to just build XML, I get this error: Could not load
>>> definitions from resource flexTasks.tasks. It could not be found.
>> 
>> I just synced the e4x branch, unset my FLEX_HOME, ASJS_HOME, FALCONJX_HOME
>> and FALCON_HOME environment variables and ran ant at the root of flex-asjs
>> and everything built.  It correctly defaulted to the appropriate folders
>> in ../flex-falcon.  If you have tried to set those variables, try not
>> setting them at all and let it choose for you.
>> 
>> I also just committed modifications of frameworks/projects/XML/build.xml
>> and got it to correctly pick up the right folders and attempt to build the
>> XML files.
>> 
>> In looking at the output in your earlier posts, it occurred to me that
>> maybe you have tried to convert your repo working copy to an
>> IDE-compatible folder.  The build.xml files don't currently support that.
>> I have updated the FB project files in the develop branch so they seem to
>> work together without having to mix the AIR SDK into the repo files.  The
>> files expect that you are using some sort of FlexJS sdk that you've
>> installed via the installer, but they only use the compiler in the SDK,
>> they don't use any of the SWCs, they only use the files in the repo.
>> 
>> HTH,
>> -Alex
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
OK. I’ll try to clean my repos and try again.

On Feb 15, 2016, at 8:30 AM, Alex Harui <ah...@adobe.com> wrote:

> 
> 
> On 2/14/16, 7:51 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> The main build.xml is not working either. I can’t seem to get anything to
>> build.
>> 
>> I just checked out the latest source from all repos.
>> 
>> When I try to build falcon, I get an error in junit. It cannot seem to
>> find TLF_HOME, AIR_HOME or FLASHPLAYER_DEBUGGER.
> 
> Please post console output somewhere.  In theory the default build should
> not need TLF_HOME.
> 
>> 
>> When trying to build flex-asjs, I get the error that it can’t get
>> https://search.maven.org/remotecontent?filepath=/org/apache/flex/flex-tool
>> -api/1.0.0/flex-tool-api-1.0.0.jar
> 
> This implies your flex-sdk is not in sync.  Change
> d103170c3246e34dabea342ec6d70d32c53017a7 removed the slash before the
> "org".
> 
> 
>> 
>> When trying to just build XML, I get this error: Could not load
>> definitions from resource flexTasks.tasks. It could not be found.
> 
> I just synced the e4x branch, unset my FLEX_HOME, ASJS_HOME, FALCONJX_HOME
> and FALCON_HOME environment variables and ran ant at the root of flex-asjs
> and everything built.  It correctly defaulted to the appropriate folders
> in ../flex-falcon.  If you have tried to set those variables, try not
> setting them at all and let it choose for you.
> 
> I also just committed modifications of frameworks/projects/XML/build.xml
> and got it to correctly pick up the right folders and attempt to build the
> XML files.
> 
> In looking at the output in your earlier posts, it occurred to me that
> maybe you have tried to convert your repo working copy to an
> IDE-compatible folder.  The build.xml files don't currently support that.
> I have updated the FB project files in the develop branch so they seem to
> work together without having to mix the AIR SDK into the repo files.  The
> files expect that you are using some sort of FlexJS sdk that you've
> installed via the installer, but they only use the compiler in the SDK,
> they don't use any of the SWCs, they only use the files in the repo.
> 
> HTH,
> -Alex
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 2/14/16, 7:51 AM, "Harbs" <ha...@gmail.com> wrote:

>The main build.xml is not working either. I can’t seem to get anything to
>build.
>
>I just checked out the latest source from all repos.
>
>When I try to build falcon, I get an error in junit. It cannot seem to
>find TLF_HOME, AIR_HOME or FLASHPLAYER_DEBUGGER.

Please post console output somewhere.  In theory the default build should
not need TLF_HOME.

>
>When trying to build flex-asjs, I get the error that it can’t get
>https://search.maven.org/remotecontent?filepath=/org/apache/flex/flex-tool
>-api/1.0.0/flex-tool-api-1.0.0.jar

This implies your flex-sdk is not in sync.  Change
d103170c3246e34dabea342ec6d70d32c53017a7 removed the slash before the
"org".


>
>When trying to just build XML, I get this error: Could not load
>definitions from resource flexTasks.tasks. It could not be found.

I just synced the e4x branch, unset my FLEX_HOME, ASJS_HOME, FALCONJX_HOME
and FALCON_HOME environment variables and ran ant at the root of flex-asjs
and everything built.  It correctly defaulted to the appropriate folders
in ../flex-falcon.  If you have tried to set those variables, try not
setting them at all and let it choose for you.

I also just committed modifications of frameworks/projects/XML/build.xml
and got it to correctly pick up the right folders and attempt to build the
XML files.

In looking at the output in your earlier posts, it occurred to me that
maybe you have tried to convert your repo working copy to an
IDE-compatible folder.  The build.xml files don't currently support that.
I have updated the FB project files in the develop branch so they seem to
work together without having to mix the AIR SDK into the repo files.  The
files expect that you are using some sort of FlexJS sdk that you've
installed via the installer, but they only use the compiler in the SDK,
they don't use any of the SWCs, they only use the files in the repo.

HTH,
-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
The main build.xml is not working either. I can’t seem to get anything to build.

I just checked out the latest source from all repos.

When I try to build falcon, I get an error in junit. It cannot seem to find TLF_HOME, AIR_HOME or FLASHPLAYER_DEBUGGER.

When trying to build flex-asjs, I get the error that it can’t get https://search.maven.org/remotecontent?filepath=/org/apache/flex/flex-tool-api/1.0.0/flex-tool-api-1.0.0.jar

When trying to just build XML, I get this error: Could not load definitions from resource flexTasks.tasks. It could not be found.

On Feb 14, 2016, at 5:19 PM, Alex Harui <ah...@adobe.com> wrote:

> Did you try my suggestions about picking up default FALCON/FALCONJX_HOME
> selection from the main build.xml?
> 
> I think the downloads.xml in flex-sdk is not up to date.  Maybe it didn't
> sync flex-sdk properly.
> 
> HTH,
> -Alex
> 
> On 2/14/16, 4:23 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> Thanks. The file location was indeed a problem.
>> 
>> I’m really suffering from not really understanding the whole process.
>> 
>> Running ant on flex-asjs results in the following error:
>> /Users/harbs/Documents/ApacheFlex/flex-asjs/build.xml:1552: The following
>> error occurred while executing this line:
>> /Users/harbs/Documents/ApacheFlex/flex-asjs/build.xml:1691: The following
>> error occurred while executing this line:
>> /Users/harbs/git/apache/flex/flex-sdk/build.xml:178: The following error
>> occurred while executing this line:
>> /Users/harbs/git/apache/flex/flex-sdk/modules/build.xml:64: The following
>> error occurred while executing this line:
>> /Users/harbs/git/apache/flex/flex-sdk/modules/downloads.xml:606: Can't
>> get 
>> https://search.maven.org/remotecontent?filepath=/org/apache/flex/flex-tool
>> -api/1.0.0/flex-tool-api-1.0.0.jar to
>> /Users/harbs/git/apache/flex/flex-sdk/in/flex-tool-api.jar
>> 
>> 
>> When I try just  building XML, I tried pointing the falcon paths to 2
>> separate places, and neither worked:
>> 
>> Harbss-MacBook-Pro:XML harbs$ ant
>> Buildfile: 
>> /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/build.
>> xml
>> 
>> clean:
>> 
>> compile-asjs:
>>    [echo] properties:
>> /Users/harbs/Documents/ApacheFlex/flex-asjs/env.properties
>>    [echo] Cross-compiling XML-0.6.0.swc
>>    [echo] FALCONJX_HOME:
>> /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler.jx
>>    [java] 
>> /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/src/ma
>> in/resources/compile-asjs-config.xml:49
>>    [java] unable to open
>> '/Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/externs/Core.swc'.
>>    [java] 
>> /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/src/ma
>> in/resources/compile-asjs-config.xml (line: 49)
>>    [java]         </library-path>
>>    [java] 
>>    [java] 
>>    [java] command line
>>    [java] unable to open
>> '/Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/bin/js.swc'.
>>    [java] 
>>    [java] 
>>    [java] command line
>>    [java] unable to open
>> '/Users/harbs/Documents/ApacheFlex/flex-falcon/externs/GCL/out/bin/GCL.swc
>> '.
>>    [java] 
>>    [java] 
>>    [java] Java Result: 5
>> 
>> compile-extern-swc:
>>    [echo] Compiling target/externs/XML-0.6.0.swc
>>    [echo] FLEX_HOME: /Users/harbs/Documents/ApacheFlex/flex-asjs
>>    [echo] FALCON_HOME:
>> /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler
>> [taskdef] Could not load definitions from resource flexTasks.tasks. It
>> could not be found.
>> 
>> BUILD FAILED
>> /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/build.
>> xml:151: Problem: failed to create task or type compc
>> Cause: The name is undefined.
>> Action: Check the spelling.
>> Action: Check that any custom tasks/types have been declared.
>> Action: Check that any <presetdef>/<macrodef> declarations have taken
>> place.
>> 
>> 
>> Total time: 0 seconds
>> Harbss-MacBook-Pro:XML harbs$ ant
>> Buildfile: 
>> /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/build.
>> xml
>> 
>> clean:
>> 
>> compile-asjs:
>>    [echo] properties:
>> /Users/harbs/Documents/ApacheFlex/flex-asjs/env.properties
>>    [echo] Cross-compiling XML-0.6.0.swc
>>    [echo] FALCONJX_HOME:
>> /Users/harbs/Documents/ApacheFlex/ApproveFalcon/apache-flex-falconjx-0.5.0
>> -src/compiler.jx
>>    [java] 
>> /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/src/ma
>> in/resources/compile-asjs-config.xml:49
>>    [java] unable to open
>> '/Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/externs/Core.swc'.
>>    [java] 
>> /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/src/ma
>> in/resources/compile-asjs-config.xml (line: 49)
>>    [java]         </library-path>
>>    [java] 
>>    [java] 
>>    [java] Java Result: 5
>> 
>> compile-extern-swc:
>>    [echo] Compiling target/externs/XML-0.6.0.swc
>>    [echo] FLEX_HOME: /Users/harbs/Documents/ApacheFlex/flex-asjs
>>    [echo] FALCON_HOME:
>> /Users/harbs/Documents/ApacheFlex/ApproveFalcon/apache-flex-falconjx-0.5.0
>> -src/compiler
>> [taskdef] Could not load definitions from resource flexTasks.tasks. It
>> could not be found.
>> 
>> BUILD FAILED
>> /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/build.
>> xml:151: Problem: failed to create task or type compc
>> Cause: The name is undefined.
>> Action: Check the spelling.
>> Action: Check that any custom tasks/types have been declared.
>> Action: Check that any <presetdef>/<macrodef> declarations have taken
>> place.
>> 
>> On Feb 12, 2016, at 5:12 PM, Josh Tynjala <jo...@gmail.com> wrote:
>> 
>>>> I’m not exactly sure what the variables are supposed to point to
>>> 
>>> Check the READme file at the root of the repository. Be sure to read
>>> through all of the numbered steps after the list of environment
>>> variables.
>>> The steps explain in more detail what paths you should be using. For
>>> instance, it says that FALCON_HOME should include
>>> compiler/generated/dist/sdk in the path.
>>> 
>>>> and I get the following errors:
>>> 
>>> Since it is echoing values like ${env.FALCONJX_HOME}, it doesn't seem
>>> to be
>>> finding your env.properties file. Did you save it in the root directory
>>> of
>>> the flex-asjs repository? Relative to your XML project, that would be
>>> ../../../env.properties.
>>> 
>>> I just checked out your branch, and I ran ant in the
>>> frameworks/projects/XML directory. It was able to find my env.properties
>>> file, so perhaps your file is in the wrong location.
>>> 
>>> - Josh
>>> 
>>> 
>>> 
>>> On Fri, Feb 12, 2016 at 2:03 AM, Harbs <ha...@gmail.com> wrote:
>>> 
>>>> I had already done pretty close to this (using outdated files, so I
>>>> just
>>>> updated it).
>>>> 
>>>> I’m running into environment variable issues again and I tried to set
>>>> up a
>>>> env.properties file to set them, but that’s not working. (I’m not
>>>> exactly
>>>> sure what the variables are supposed to point to)
>>>> 
>>>> Here’s the file I created:
>>>> 
>>>> 
>>>> env.AIR_HOME=/Users/harbs/Documents/ApacheFlex/frameworks/AIRSDK_Compile
>>>> r
>>>> 
>>>> env.FLASHPLAYER_DEBUGGER=/Users/harbs/Documents/ApacheFlex/frameworks/Fl
>>>> ash
>>>> Player Debugger.app/Contents/MacOS/Flash Player Debugger
>>>> env.FALCON_HOME=/Users/harbs/Documents/ApacheFlex/flex-falcon/compiler
>>>> 
>>>> env.FALCONJX_HOME=/Users/harbs/Documents/ApacheFlex/flex-falcon/compiler
>>>> .jx
>>>> 
>>>> and I get the following errors:
>>>> compile-asjs:
>>>>    [echo] Cross-compiling XML-0.6.0.swc
>>>>    [echo] FALCONJX_HOME: ${env.FALCONJX_HOME}
>>>>    [java] Error: Unable to access jarfile
>>>> 
>>>> /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/${en
>>>> v.FALCONJX_HOME}/lib/compc.jar
>>>>    [java] Java Result: 1
>>>> 
>>>> compile-extern-swc:
>>>>    [echo] Compiling target/externs/XML-0.6.0.swc
>>>>    [echo] FLEX_HOME: /Users/harbs/Documents/ApacheFlex/flex-asjs
>>>>    [echo] FALCON_HOME: ${env.FALCON_HOME}
>>>> 
>>>> 
>>>> How do we simplify setting environment variables? What I’ve been doing
>>>> is
>>>> writing shell scripts for every custom build I do, but that’s
>>>> ridiculous,
>>>> and it creates a barrier for others wanting to get involved.
>>>> 
>>>> On Feb 11, 2016, at 5:59 PM, Alex Harui <ah...@adobe.com> wrote:
>>>> 
>>>>> IIRC, you are trying to get the build to work in a new XML folder?
>>>>> 
>>>>> In theory, you can copy any build.xml from, say Binding into the root
>>>>> of
>>>>> XML.  Open it and search for Binding and replace with XML.
>>>>> 
>>>>> Next, copy the src/main/resources folder from Binding.  Open
>>>>> compile-config.xml and search and replace Binding.
>>>>> 
>>>>> Open compile-asjs-config.xml and do the same.
>>>>> 
>>>>> If you don't have a src/main/flex/XMLClasses.as file, create one and
>>>>> list
>>>>> the files you want to compile.  If you don't want a particular class
>>>>> in
>>>>> the AS version of the SWC, put it in a COMPILE::AS3 block.
>>>>> 
>>>>> Open basic-manifest.xml and comment everything out.  This is the list
>>>>> of
>>>>> components that go in MXML, but I think you are emulating classes that
>>>> are
>>>>> already in the fx: namespace so you shouldn't need anything.
>>>>> 
>>>>> Then running "ant" from XML should "do the right thing".
>>>>> 
>>>>> To integrate into the main build, open frameworks/build.xml, search
>>>>> for
>>>>> Binding and clone the patterns you see.
>>>>> 
>>>>> HTH,
>>>>> -Alex
>>>>> 
>>>>> On 2/11/16, 1:25 AM, "Harbs" <ha...@gmail.com> wrote:
>>>>> 
>>>>>> OK. I merged and copied the new folder structure. Unfortunately I
>>>>>> have
>>>> no
>>>>>> idea how to set up the compilation. I just copied the folder
>>>>>> structure
>>>>>> like a monkey, but I have no idea how it’s supposed to work.
>>>>>> 
>>>>>> Can someone help me set up the scripts so it can actually compile
>>>>>> something? Once I understand how the compilation is supposed to
>>>>>> work, I
>>>>>> can continue with this.
>>>>>> 
>>>>>> Harbs
>>>>>> 
>>>>>> On Feb 11, 2016, at 10:56 AM, Harbs <ha...@gmail.com> wrote:
>>>>>> 
>>>>>>> OK. I’m up to #2. I know of a number of problems/holes in the
>>>>>>> implementation as it stands and there’s probably a lot of problems
>>>>>>> I’m
>>>>>>> not aware of, but I’m going to try to get to the point where this
>>>>>>> compiles and actually does something to make the problems more
>>>>>>> visible.
>>>>>>> 
>>>>>>> Maybe some other folks can even help at that point… ;-)
>>>>>>> 
>>>>>>> On Feb 8, 2016, at 11:00 AM, Harbs <ha...@gmail.com> wrote:
>>>>>>> 
>>>>>>>> So here’s my current plan:
>>>>>>>> 1. Finish up the methods (minus filtering) in the next day or two.
>>>>>>>> 2. Sync up XML with the current FlexJS folder structure and get
>>>>>>>> rid of
>>>>>>>> some junk (like all the JXON classes).
>>>>>>>> 3. Get this all to compile.
>>>>>>>> 4. Figure out the whole filtering issue.
>>>>>>>> 5. Create test cases.
>>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>>> 
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Alex Harui <ah...@adobe.com>.
Did you try my suggestions about picking up default FALCON/FALCONJX_HOME
selection from the main build.xml?

I think the downloads.xml in flex-sdk is not up to date.  Maybe it didn't
sync flex-sdk properly.

HTH,
-Alex

On 2/14/16, 4:23 AM, "Harbs" <ha...@gmail.com> wrote:

>Thanks. The file location was indeed a problem.
>
>I’m really suffering from not really understanding the whole process.
>
>Running ant on flex-asjs results in the following error:
>/Users/harbs/Documents/ApacheFlex/flex-asjs/build.xml:1552: The following
>error occurred while executing this line:
>/Users/harbs/Documents/ApacheFlex/flex-asjs/build.xml:1691: The following
>error occurred while executing this line:
>/Users/harbs/git/apache/flex/flex-sdk/build.xml:178: The following error
>occurred while executing this line:
>/Users/harbs/git/apache/flex/flex-sdk/modules/build.xml:64: The following
>error occurred while executing this line:
>/Users/harbs/git/apache/flex/flex-sdk/modules/downloads.xml:606: Can't
>get 
>https://search.maven.org/remotecontent?filepath=/org/apache/flex/flex-tool
>-api/1.0.0/flex-tool-api-1.0.0.jar to
>/Users/harbs/git/apache/flex/flex-sdk/in/flex-tool-api.jar
>
>
>When I try just  building XML, I tried pointing the falcon paths to 2
>separate places, and neither worked:
>
>Harbss-MacBook-Pro:XML harbs$ ant
>Buildfile: 
>/Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/build.
>xml
>
>clean:
>
>compile-asjs:
>     [echo] properties:
>/Users/harbs/Documents/ApacheFlex/flex-asjs/env.properties
>     [echo] Cross-compiling XML-0.6.0.swc
>     [echo] FALCONJX_HOME:
>/Users/harbs/Documents/ApacheFlex/flex-falcon/compiler.jx
>     [java] 
>/Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/src/ma
>in/resources/compile-asjs-config.xml:49
>     [java] unable to open
>'/Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/externs/Core.swc'.
>     [java] 
>/Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/src/ma
>in/resources/compile-asjs-config.xml (line: 49)
>     [java]         </library-path>
>     [java] 
>     [java] 
>     [java] command line
>     [java] unable to open
>'/Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/bin/js.swc'.
>     [java] 
>     [java] 
>     [java] command line
>     [java] unable to open
>'/Users/harbs/Documents/ApacheFlex/flex-falcon/externs/GCL/out/bin/GCL.swc
>'.
>     [java] 
>     [java] 
>     [java] Java Result: 5
>
>compile-extern-swc:
>     [echo] Compiling target/externs/XML-0.6.0.swc
>     [echo] FLEX_HOME: /Users/harbs/Documents/ApacheFlex/flex-asjs
>     [echo] FALCON_HOME:
>/Users/harbs/Documents/ApacheFlex/flex-falcon/compiler
>  [taskdef] Could not load definitions from resource flexTasks.tasks. It
>could not be found.
>
>BUILD FAILED
>/Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/build.
>xml:151: Problem: failed to create task or type compc
>Cause: The name is undefined.
>Action: Check the spelling.
>Action: Check that any custom tasks/types have been declared.
>Action: Check that any <presetdef>/<macrodef> declarations have taken
>place.
>
>
>Total time: 0 seconds
>Harbss-MacBook-Pro:XML harbs$ ant
>Buildfile: 
>/Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/build.
>xml
>
>clean:
>
>compile-asjs:
>     [echo] properties:
>/Users/harbs/Documents/ApacheFlex/flex-asjs/env.properties
>     [echo] Cross-compiling XML-0.6.0.swc
>     [echo] FALCONJX_HOME:
>/Users/harbs/Documents/ApacheFlex/ApproveFalcon/apache-flex-falconjx-0.5.0
>-src/compiler.jx
>     [java] 
>/Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/src/ma
>in/resources/compile-asjs-config.xml:49
>     [java] unable to open
>'/Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/externs/Core.swc'.
>     [java] 
>/Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/src/ma
>in/resources/compile-asjs-config.xml (line: 49)
>     [java]         </library-path>
>     [java] 
>     [java] 
>     [java] Java Result: 5
>
>compile-extern-swc:
>     [echo] Compiling target/externs/XML-0.6.0.swc
>     [echo] FLEX_HOME: /Users/harbs/Documents/ApacheFlex/flex-asjs
>     [echo] FALCON_HOME:
>/Users/harbs/Documents/ApacheFlex/ApproveFalcon/apache-flex-falconjx-0.5.0
>-src/compiler
>  [taskdef] Could not load definitions from resource flexTasks.tasks. It
>could not be found.
>
>BUILD FAILED
>/Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/build.
>xml:151: Problem: failed to create task or type compc
>Cause: The name is undefined.
>Action: Check the spelling.
>Action: Check that any custom tasks/types have been declared.
>Action: Check that any <presetdef>/<macrodef> declarations have taken
>place.
>
>On Feb 12, 2016, at 5:12 PM, Josh Tynjala <jo...@gmail.com> wrote:
>
>>> I’m not exactly sure what the variables are supposed to point to
>> 
>> Check the READme file at the root of the repository. Be sure to read
>> through all of the numbered steps after the list of environment
>>variables.
>> The steps explain in more detail what paths you should be using. For
>> instance, it says that FALCON_HOME should include
>> compiler/generated/dist/sdk in the path.
>> 
>>> and I get the following errors:
>> 
>> Since it is echoing values like ${env.FALCONJX_HOME}, it doesn't seem
>>to be
>> finding your env.properties file. Did you save it in the root directory
>>of
>> the flex-asjs repository? Relative to your XML project, that would be
>> ../../../env.properties.
>> 
>> I just checked out your branch, and I ran ant in the
>> frameworks/projects/XML directory. It was able to find my env.properties
>> file, so perhaps your file is in the wrong location.
>> 
>> - Josh
>> 
>> 
>> 
>> On Fri, Feb 12, 2016 at 2:03 AM, Harbs <ha...@gmail.com> wrote:
>> 
>>> I had already done pretty close to this (using outdated files, so I
>>>just
>>> updated it).
>>> 
>>> I’m running into environment variable issues again and I tried to set
>>>up a
>>> env.properties file to set them, but that’s not working. (I’m not
>>>exactly
>>> sure what the variables are supposed to point to)
>>> 
>>> Here’s the file I created:
>>> 
>>> 
>>>env.AIR_HOME=/Users/harbs/Documents/ApacheFlex/frameworks/AIRSDK_Compile
>>>r
>>> 
>>>env.FLASHPLAYER_DEBUGGER=/Users/harbs/Documents/ApacheFlex/frameworks/Fl
>>>ash
>>> Player Debugger.app/Contents/MacOS/Flash Player Debugger
>>> env.FALCON_HOME=/Users/harbs/Documents/ApacheFlex/flex-falcon/compiler
>>> 
>>>env.FALCONJX_HOME=/Users/harbs/Documents/ApacheFlex/flex-falcon/compiler
>>>.jx
>>> 
>>> and I get the following errors:
>>> compile-asjs:
>>>     [echo] Cross-compiling XML-0.6.0.swc
>>>     [echo] FALCONJX_HOME: ${env.FALCONJX_HOME}
>>>     [java] Error: Unable to access jarfile
>>> 
>>>/Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/${en
>>>v.FALCONJX_HOME}/lib/compc.jar
>>>     [java] Java Result: 1
>>> 
>>> compile-extern-swc:
>>>     [echo] Compiling target/externs/XML-0.6.0.swc
>>>     [echo] FLEX_HOME: /Users/harbs/Documents/ApacheFlex/flex-asjs
>>>     [echo] FALCON_HOME: ${env.FALCON_HOME}
>>> 
>>> 
>>> How do we simplify setting environment variables? What I’ve been doing
>>>is
>>> writing shell scripts for every custom build I do, but that’s
>>>ridiculous,
>>> and it creates a barrier for others wanting to get involved.
>>> 
>>> On Feb 11, 2016, at 5:59 PM, Alex Harui <ah...@adobe.com> wrote:
>>> 
>>>> IIRC, you are trying to get the build to work in a new XML folder?
>>>> 
>>>> In theory, you can copy any build.xml from, say Binding into the root
>>>>of
>>>> XML.  Open it and search for Binding and replace with XML.
>>>> 
>>>> Next, copy the src/main/resources folder from Binding.  Open
>>>> compile-config.xml and search and replace Binding.
>>>> 
>>>> Open compile-asjs-config.xml and do the same.
>>>> 
>>>> If you don't have a src/main/flex/XMLClasses.as file, create one and
>>>>list
>>>> the files you want to compile.  If you don't want a particular class
>>>>in
>>>> the AS version of the SWC, put it in a COMPILE::AS3 block.
>>>> 
>>>> Open basic-manifest.xml and comment everything out.  This is the list
>>>>of
>>>> components that go in MXML, but I think you are emulating classes that
>>> are
>>>> already in the fx: namespace so you shouldn't need anything.
>>>> 
>>>> Then running "ant" from XML should "do the right thing".
>>>> 
>>>> To integrate into the main build, open frameworks/build.xml, search
>>>>for
>>>> Binding and clone the patterns you see.
>>>> 
>>>> HTH,
>>>> -Alex
>>>> 
>>>> On 2/11/16, 1:25 AM, "Harbs" <ha...@gmail.com> wrote:
>>>> 
>>>>> OK. I merged and copied the new folder structure. Unfortunately I
>>>>>have
>>> no
>>>>> idea how to set up the compilation. I just copied the folder
>>>>>structure
>>>>> like a monkey, but I have no idea how it’s supposed to work.
>>>>> 
>>>>> Can someone help me set up the scripts so it can actually compile
>>>>> something? Once I understand how the compilation is supposed to
>>>>>work, I
>>>>> can continue with this.
>>>>> 
>>>>> Harbs
>>>>> 
>>>>> On Feb 11, 2016, at 10:56 AM, Harbs <ha...@gmail.com> wrote:
>>>>> 
>>>>>> OK. I’m up to #2. I know of a number of problems/holes in the
>>>>>> implementation as it stands and there’s probably a lot of problems
>>>>>>I’m
>>>>>> not aware of, but I’m going to try to get to the point where this
>>>>>> compiles and actually does something to make the problems more
>>>>>>visible.
>>>>>> 
>>>>>> Maybe some other folks can even help at that point… ;-)
>>>>>> 
>>>>>> On Feb 8, 2016, at 11:00 AM, Harbs <ha...@gmail.com> wrote:
>>>>>> 
>>>>>>> So here’s my current plan:
>>>>>>> 1. Finish up the methods (minus filtering) in the next day or two.
>>>>>>> 2. Sync up XML with the current FlexJS folder structure and get
>>>>>>>rid of
>>>>>>> some junk (like all the JXON classes).
>>>>>>> 3. Get this all to compile.
>>>>>>> 4. Figure out the whole filtering issue.
>>>>>>> 5. Create test cases.
>>>>>> 
>>>>> 
>>>> 
>>> 
>>> 
>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Thanks. The file location was indeed a problem.

I’m really suffering from not really understanding the whole process.

Running ant on flex-asjs results in the following error:
/Users/harbs/Documents/ApacheFlex/flex-asjs/build.xml:1552: The following error occurred while executing this line:
/Users/harbs/Documents/ApacheFlex/flex-asjs/build.xml:1691: The following error occurred while executing this line:
/Users/harbs/git/apache/flex/flex-sdk/build.xml:178: The following error occurred while executing this line:
/Users/harbs/git/apache/flex/flex-sdk/modules/build.xml:64: The following error occurred while executing this line:
/Users/harbs/git/apache/flex/flex-sdk/modules/downloads.xml:606: Can't get https://search.maven.org/remotecontent?filepath=/org/apache/flex/flex-tool-api/1.0.0/flex-tool-api-1.0.0.jar to /Users/harbs/git/apache/flex/flex-sdk/in/flex-tool-api.jar


When I try just  building XML, I tried pointing the falcon paths to 2 separate places, and neither worked:

Harbss-MacBook-Pro:XML harbs$ ant
Buildfile: /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/build.xml

clean:

compile-asjs:
     [echo] properties: /Users/harbs/Documents/ApacheFlex/flex-asjs/env.properties
     [echo] Cross-compiling XML-0.6.0.swc
     [echo] FALCONJX_HOME: /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler.jx
     [java] /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/src/main/resources/compile-asjs-config.xml:49
     [java] unable to open '/Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/externs/Core.swc'.
     [java] /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/src/main/resources/compile-asjs-config.xml (line: 49)
     [java]         </library-path>
     [java] 
     [java] 
     [java] command line
     [java] unable to open '/Users/harbs/Documents/ApacheFlex/flex-falcon/externs/js/out/bin/js.swc'.
     [java] 
     [java] 
     [java] command line
     [java] unable to open '/Users/harbs/Documents/ApacheFlex/flex-falcon/externs/GCL/out/bin/GCL.swc'.
     [java] 
     [java] 
     [java] Java Result: 5

compile-extern-swc:
     [echo] Compiling target/externs/XML-0.6.0.swc
     [echo] FLEX_HOME: /Users/harbs/Documents/ApacheFlex/flex-asjs
     [echo] FALCON_HOME: /Users/harbs/Documents/ApacheFlex/flex-falcon/compiler
  [taskdef] Could not load definitions from resource flexTasks.tasks. It could not be found.

BUILD FAILED
/Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/build.xml:151: Problem: failed to create task or type compc
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.


Total time: 0 seconds
Harbss-MacBook-Pro:XML harbs$ ant
Buildfile: /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/build.xml

clean:

compile-asjs:
     [echo] properties: /Users/harbs/Documents/ApacheFlex/flex-asjs/env.properties
     [echo] Cross-compiling XML-0.6.0.swc
     [echo] FALCONJX_HOME: /Users/harbs/Documents/ApacheFlex/ApproveFalcon/apache-flex-falconjx-0.5.0-src/compiler.jx
     [java] /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/src/main/resources/compile-asjs-config.xml:49
     [java] unable to open '/Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/externs/Core.swc'.
     [java] /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/src/main/resources/compile-asjs-config.xml (line: 49)
     [java]         </library-path>
     [java] 
     [java] 
     [java] Java Result: 5

compile-extern-swc:
     [echo] Compiling target/externs/XML-0.6.0.swc
     [echo] FLEX_HOME: /Users/harbs/Documents/ApacheFlex/flex-asjs
     [echo] FALCON_HOME: /Users/harbs/Documents/ApacheFlex/ApproveFalcon/apache-flex-falconjx-0.5.0-src/compiler
  [taskdef] Could not load definitions from resource flexTasks.tasks. It could not be found.

BUILD FAILED
/Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/build.xml:151: Problem: failed to create task or type compc
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.

On Feb 12, 2016, at 5:12 PM, Josh Tynjala <jo...@gmail.com> wrote:

>> I’m not exactly sure what the variables are supposed to point to
> 
> Check the READme file at the root of the repository. Be sure to read
> through all of the numbered steps after the list of environment variables.
> The steps explain in more detail what paths you should be using. For
> instance, it says that FALCON_HOME should include
> compiler/generated/dist/sdk in the path.
> 
>> and I get the following errors:
> 
> Since it is echoing values like ${env.FALCONJX_HOME}, it doesn't seem to be
> finding your env.properties file. Did you save it in the root directory of
> the flex-asjs repository? Relative to your XML project, that would be
> ../../../env.properties.
> 
> I just checked out your branch, and I ran ant in the
> frameworks/projects/XML directory. It was able to find my env.properties
> file, so perhaps your file is in the wrong location.
> 
> - Josh
> 
> 
> 
> On Fri, Feb 12, 2016 at 2:03 AM, Harbs <ha...@gmail.com> wrote:
> 
>> I had already done pretty close to this (using outdated files, so I just
>> updated it).
>> 
>> I’m running into environment variable issues again and I tried to set up a
>> env.properties file to set them, but that’s not working. (I’m not exactly
>> sure what the variables are supposed to point to)
>> 
>> Here’s the file I created:
>> 
>> env.AIR_HOME=/Users/harbs/Documents/ApacheFlex/frameworks/AIRSDK_Compiler
>> env.FLASHPLAYER_DEBUGGER=/Users/harbs/Documents/ApacheFlex/frameworks/Flash
>> Player Debugger.app/Contents/MacOS/Flash Player Debugger
>> env.FALCON_HOME=/Users/harbs/Documents/ApacheFlex/flex-falcon/compiler
>> env.FALCONJX_HOME=/Users/harbs/Documents/ApacheFlex/flex-falcon/compiler.jx
>> 
>> and I get the following errors:
>> compile-asjs:
>>     [echo] Cross-compiling XML-0.6.0.swc
>>     [echo] FALCONJX_HOME: ${env.FALCONJX_HOME}
>>     [java] Error: Unable to access jarfile
>> /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/${env.FALCONJX_HOME}/lib/compc.jar
>>     [java] Java Result: 1
>> 
>> compile-extern-swc:
>>     [echo] Compiling target/externs/XML-0.6.0.swc
>>     [echo] FLEX_HOME: /Users/harbs/Documents/ApacheFlex/flex-asjs
>>     [echo] FALCON_HOME: ${env.FALCON_HOME}
>> 
>> 
>> How do we simplify setting environment variables? What I’ve been doing is
>> writing shell scripts for every custom build I do, but that’s ridiculous,
>> and it creates a barrier for others wanting to get involved.
>> 
>> On Feb 11, 2016, at 5:59 PM, Alex Harui <ah...@adobe.com> wrote:
>> 
>>> IIRC, you are trying to get the build to work in a new XML folder?
>>> 
>>> In theory, you can copy any build.xml from, say Binding into the root of
>>> XML.  Open it and search for Binding and replace with XML.
>>> 
>>> Next, copy the src/main/resources folder from Binding.  Open
>>> compile-config.xml and search and replace Binding.
>>> 
>>> Open compile-asjs-config.xml and do the same.
>>> 
>>> If you don't have a src/main/flex/XMLClasses.as file, create one and list
>>> the files you want to compile.  If you don't want a particular class in
>>> the AS version of the SWC, put it in a COMPILE::AS3 block.
>>> 
>>> Open basic-manifest.xml and comment everything out.  This is the list of
>>> components that go in MXML, but I think you are emulating classes that
>> are
>>> already in the fx: namespace so you shouldn't need anything.
>>> 
>>> Then running "ant" from XML should "do the right thing".
>>> 
>>> To integrate into the main build, open frameworks/build.xml, search for
>>> Binding and clone the patterns you see.
>>> 
>>> HTH,
>>> -Alex
>>> 
>>> On 2/11/16, 1:25 AM, "Harbs" <ha...@gmail.com> wrote:
>>> 
>>>> OK. I merged and copied the new folder structure. Unfortunately I have
>> no
>>>> idea how to set up the compilation. I just copied the folder structure
>>>> like a monkey, but I have no idea how it’s supposed to work.
>>>> 
>>>> Can someone help me set up the scripts so it can actually compile
>>>> something? Once I understand how the compilation is supposed to work, I
>>>> can continue with this.
>>>> 
>>>> Harbs
>>>> 
>>>> On Feb 11, 2016, at 10:56 AM, Harbs <ha...@gmail.com> wrote:
>>>> 
>>>>> OK. I’m up to #2. I know of a number of problems/holes in the
>>>>> implementation as it stands and there’s probably a lot of problems I’m
>>>>> not aware of, but I’m going to try to get to the point where this
>>>>> compiles and actually does something to make the problems more visible.
>>>>> 
>>>>> Maybe some other folks can even help at that point… ;-)
>>>>> 
>>>>> On Feb 8, 2016, at 11:00 AM, Harbs <ha...@gmail.com> wrote:
>>>>> 
>>>>>> So here’s my current plan:
>>>>>> 1. Finish up the methods (minus filtering) in the next day or two.
>>>>>> 2. Sync up XML with the current FlexJS folder structure and get rid of
>>>>>> some junk (like all the JXON classes).
>>>>>> 3. Get this all to compile.
>>>>>> 4. Figure out the whole filtering issue.
>>>>>> 5. Create test cases.
>>>>> 
>>>> 
>>> 
>> 
>> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Josh Tynjala <jo...@gmail.com>.
> I’m not exactly sure what the variables are supposed to point to

Check the READme file at the root of the repository. Be sure to read
through all of the numbered steps after the list of environment variables.
The steps explain in more detail what paths you should be using. For
instance, it says that FALCON_HOME should include
compiler/generated/dist/sdk in the path.

> and I get the following errors:

Since it is echoing values like ${env.FALCONJX_HOME}, it doesn't seem to be
finding your env.properties file. Did you save it in the root directory of
the flex-asjs repository? Relative to your XML project, that would be
../../../env.properties.

I just checked out your branch, and I ran ant in the
frameworks/projects/XML directory. It was able to find my env.properties
file, so perhaps your file is in the wrong location.

- Josh



On Fri, Feb 12, 2016 at 2:03 AM, Harbs <ha...@gmail.com> wrote:

> I had already done pretty close to this (using outdated files, so I just
> updated it).
>
> I’m running into environment variable issues again and I tried to set up a
> env.properties file to set them, but that’s not working. (I’m not exactly
> sure what the variables are supposed to point to)
>
> Here’s the file I created:
>
> env.AIR_HOME=/Users/harbs/Documents/ApacheFlex/frameworks/AIRSDK_Compiler
> env.FLASHPLAYER_DEBUGGER=/Users/harbs/Documents/ApacheFlex/frameworks/Flash
> Player Debugger.app/Contents/MacOS/Flash Player Debugger
> env.FALCON_HOME=/Users/harbs/Documents/ApacheFlex/flex-falcon/compiler
> env.FALCONJX_HOME=/Users/harbs/Documents/ApacheFlex/flex-falcon/compiler.jx
>
> and I get the following errors:
> compile-asjs:
>      [echo] Cross-compiling XML-0.6.0.swc
>      [echo] FALCONJX_HOME: ${env.FALCONJX_HOME}
>      [java] Error: Unable to access jarfile
> /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/${env.FALCONJX_HOME}/lib/compc.jar
>      [java] Java Result: 1
>
> compile-extern-swc:
>      [echo] Compiling target/externs/XML-0.6.0.swc
>      [echo] FLEX_HOME: /Users/harbs/Documents/ApacheFlex/flex-asjs
>      [echo] FALCON_HOME: ${env.FALCON_HOME}
>
>
> How do we simplify setting environment variables? What I’ve been doing is
> writing shell scripts for every custom build I do, but that’s ridiculous,
> and it creates a barrier for others wanting to get involved.
>
> On Feb 11, 2016, at 5:59 PM, Alex Harui <ah...@adobe.com> wrote:
>
> > IIRC, you are trying to get the build to work in a new XML folder?
> >
> > In theory, you can copy any build.xml from, say Binding into the root of
> > XML.  Open it and search for Binding and replace with XML.
> >
> > Next, copy the src/main/resources folder from Binding.  Open
> > compile-config.xml and search and replace Binding.
> >
> > Open compile-asjs-config.xml and do the same.
> >
> > If you don't have a src/main/flex/XMLClasses.as file, create one and list
> > the files you want to compile.  If you don't want a particular class in
> > the AS version of the SWC, put it in a COMPILE::AS3 block.
> >
> > Open basic-manifest.xml and comment everything out.  This is the list of
> > components that go in MXML, but I think you are emulating classes that
> are
> > already in the fx: namespace so you shouldn't need anything.
> >
> > Then running "ant" from XML should "do the right thing".
> >
> > To integrate into the main build, open frameworks/build.xml, search for
> > Binding and clone the patterns you see.
> >
> > HTH,
> > -Alex
> >
> > On 2/11/16, 1:25 AM, "Harbs" <ha...@gmail.com> wrote:
> >
> >> OK. I merged and copied the new folder structure. Unfortunately I have
> no
> >> idea how to set up the compilation. I just copied the folder structure
> >> like a monkey, but I have no idea how it’s supposed to work.
> >>
> >> Can someone help me set up the scripts so it can actually compile
> >> something? Once I understand how the compilation is supposed to work, I
> >> can continue with this.
> >>
> >> Harbs
> >>
> >> On Feb 11, 2016, at 10:56 AM, Harbs <ha...@gmail.com> wrote:
> >>
> >>> OK. I’m up to #2. I know of a number of problems/holes in the
> >>> implementation as it stands and there’s probably a lot of problems I’m
> >>> not aware of, but I’m going to try to get to the point where this
> >>> compiles and actually does something to make the problems more visible.
> >>>
> >>> Maybe some other folks can even help at that point… ;-)
> >>>
> >>> On Feb 8, 2016, at 11:00 AM, Harbs <ha...@gmail.com> wrote:
> >>>
> >>>> So here’s my current plan:
> >>>> 1. Finish up the methods (minus filtering) in the next day or two.
> >>>> 2. Sync up XML with the current FlexJS folder structure and get rid of
> >>>> some junk (like all the JXON classes).
> >>>> 3. Get this all to compile.
> >>>> 4. Figure out the whole filtering issue.
> >>>> 5. Create test cases.
> >>>
> >>
> >
>
>

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
I had already done pretty close to this (using outdated files, so I just updated it).

I’m running into environment variable issues again and I tried to set up a env.properties file to set them, but that’s not working. (I’m not exactly sure what the variables are supposed to point to)

Here’s the file I created:

env.AIR_HOME=/Users/harbs/Documents/ApacheFlex/frameworks/AIRSDK_Compiler
env.FLASHPLAYER_DEBUGGER=/Users/harbs/Documents/ApacheFlex/frameworks/Flash Player Debugger.app/Contents/MacOS/Flash Player Debugger
env.FALCON_HOME=/Users/harbs/Documents/ApacheFlex/flex-falcon/compiler
env.FALCONJX_HOME=/Users/harbs/Documents/ApacheFlex/flex-falcon/compiler.jx

and I get the following errors:
compile-asjs:
     [echo] Cross-compiling XML-0.6.0.swc
     [echo] FALCONJX_HOME: ${env.FALCONJX_HOME}
     [java] Error: Unable to access jarfile /Users/harbs/Documents/ApacheFlex/flex-asjs/frameworks/projects/XML/${env.FALCONJX_HOME}/lib/compc.jar
     [java] Java Result: 1

compile-extern-swc:
     [echo] Compiling target/externs/XML-0.6.0.swc
     [echo] FLEX_HOME: /Users/harbs/Documents/ApacheFlex/flex-asjs
     [echo] FALCON_HOME: ${env.FALCON_HOME}


How do we simplify setting environment variables? What I’ve been doing is writing shell scripts for every custom build I do, but that’s ridiculous, and it creates a barrier for others wanting to get involved.

On Feb 11, 2016, at 5:59 PM, Alex Harui <ah...@adobe.com> wrote:

> IIRC, you are trying to get the build to work in a new XML folder?
> 
> In theory, you can copy any build.xml from, say Binding into the root of
> XML.  Open it and search for Binding and replace with XML.
> 
> Next, copy the src/main/resources folder from Binding.  Open
> compile-config.xml and search and replace Binding.
> 
> Open compile-asjs-config.xml and do the same.
> 
> If you don't have a src/main/flex/XMLClasses.as file, create one and list
> the files you want to compile.  If you don't want a particular class in
> the AS version of the SWC, put it in a COMPILE::AS3 block.
> 
> Open basic-manifest.xml and comment everything out.  This is the list of
> components that go in MXML, but I think you are emulating classes that are
> already in the fx: namespace so you shouldn't need anything.
> 
> Then running "ant" from XML should "do the right thing".
> 
> To integrate into the main build, open frameworks/build.xml, search for
> Binding and clone the patterns you see.
> 
> HTH,
> -Alex
> 
> On 2/11/16, 1:25 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> OK. I merged and copied the new folder structure. Unfortunately I have no
>> idea how to set up the compilation. I just copied the folder structure
>> like a monkey, but I have no idea how it’s supposed to work.
>> 
>> Can someone help me set up the scripts so it can actually compile
>> something? Once I understand how the compilation is supposed to work, I
>> can continue with this.
>> 
>> Harbs
>> 
>> On Feb 11, 2016, at 10:56 AM, Harbs <ha...@gmail.com> wrote:
>> 
>>> OK. I’m up to #2. I know of a number of problems/holes in the
>>> implementation as it stands and there’s probably a lot of problems I’m
>>> not aware of, but I’m going to try to get to the point where this
>>> compiles and actually does something to make the problems more visible.
>>> 
>>> Maybe some other folks can even help at that point… ;-)
>>> 
>>> On Feb 8, 2016, at 11:00 AM, Harbs <ha...@gmail.com> wrote:
>>> 
>>>> So here’s my current plan:
>>>> 1. Finish up the methods (minus filtering) in the next day or two.
>>>> 2. Sync up XML with the current FlexJS folder structure and get rid of
>>>> some junk (like all the JXON classes).
>>>> 3. Get this all to compile.
>>>> 4. Figure out the whole filtering issue.
>>>> 5. Create test cases.
>>> 
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Alex Harui <ah...@adobe.com>.
IIRC, you are trying to get the build to work in a new XML folder?

In theory, you can copy any build.xml from, say Binding into the root of
XML.  Open it and search for Binding and replace with XML.

Next, copy the src/main/resources folder from Binding.  Open
compile-config.xml and search and replace Binding.

Open compile-asjs-config.xml and do the same.

If you don't have a src/main/flex/XMLClasses.as file, create one and list
the files you want to compile.  If you don't want a particular class in
the AS version of the SWC, put it in a COMPILE::AS3 block.

Open basic-manifest.xml and comment everything out.  This is the list of
components that go in MXML, but I think you are emulating classes that are
already in the fx: namespace so you shouldn't need anything.

Then running "ant" from XML should "do the right thing".

To integrate into the main build, open frameworks/build.xml, search for
Binding and clone the patterns you see.

HTH,
-Alex

On 2/11/16, 1:25 AM, "Harbs" <ha...@gmail.com> wrote:

>OK. I merged and copied the new folder structure. Unfortunately I have no
>idea how to set up the compilation. I just copied the folder structure
>like a monkey, but I have no idea how it’s supposed to work.
>
>Can someone help me set up the scripts so it can actually compile
>something? Once I understand how the compilation is supposed to work, I
>can continue with this.
>
>Harbs
>
>On Feb 11, 2016, at 10:56 AM, Harbs <ha...@gmail.com> wrote:
>
>> OK. I’m up to #2. I know of a number of problems/holes in the
>>implementation as it stands and there’s probably a lot of problems I’m
>>not aware of, but I’m going to try to get to the point where this
>>compiles and actually does something to make the problems more visible.
>> 
>> Maybe some other folks can even help at that point… ;-)
>> 
>> On Feb 8, 2016, at 11:00 AM, Harbs <ha...@gmail.com> wrote:
>> 
>>> So here’s my current plan:
>>> 1. Finish up the methods (minus filtering) in the next day or two.
>>> 2. Sync up XML with the current FlexJS folder structure and get rid of
>>>some junk (like all the JXON classes).
>>> 3. Get this all to compile.
>>> 4. Figure out the whole filtering issue.
>>> 5. Create test cases.
>> 
>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
OK. I merged and copied the new folder structure. Unfortunately I have no idea how to set up the compilation. I just copied the folder structure like a monkey, but I have no idea how it’s supposed to work.

Can someone help me set up the scripts so it can actually compile something? Once I understand how the compilation is supposed to work, I can continue with this.

Harbs

On Feb 11, 2016, at 10:56 AM, Harbs <ha...@gmail.com> wrote:

> OK. I’m up to #2. I know of a number of problems/holes in the implementation as it stands and there’s probably a lot of problems I’m not aware of, but I’m going to try to get to the point where this compiles and actually does something to make the problems more visible.
> 
> Maybe some other folks can even help at that point… ;-)
> 
> On Feb 8, 2016, at 11:00 AM, Harbs <ha...@gmail.com> wrote:
> 
>> So here’s my current plan:
>> 1. Finish up the methods (minus filtering) in the next day or two.
>> 2. Sync up XML with the current FlexJS folder structure and get rid of some junk (like all the JXON classes).
>> 3. Get this all to compile.
>> 4. Figure out the whole filtering issue.
>> 5. Create test cases.
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
OK. I’m up to #2. I know of a number of problems/holes in the implementation as it stands and there’s probably a lot of problems I’m not aware of, but I’m going to try to get to the point where this compiles and actually does something to make the problems more visible.

Maybe some other folks can even help at that point… ;-)

On Feb 8, 2016, at 11:00 AM, Harbs <ha...@gmail.com> wrote:

> So here’s my current plan:
> 1. Finish up the methods (minus filtering) in the next day or two.
> 2. Sync up XML with the current FlexJS folder structure and get rid of some junk (like all the JXON classes).
> 3. Get this all to compile.
> 4. Figure out the whole filtering issue.
> 5. Create test cases.


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Yes.

The internal methods are definitely different than the public APIs. For example, there is both a [[Replace]] internal method as well as a replace() API. The two do very different things. I also just realized that there is both [[InScopeNamespaces]] and inScopeNamespaces().

You are right that I was confused by [[Length]] which does refer to the length of the internal list of properties and not the length(). However the spec does not specify bracket notation internally, so that’s not very clear. It could just be I’m not very experienced at reading specification documentation… ;-)

I have implemented some of the internal methods/properties, but not all. I’m not sure it makes sense to implement them all.

It could be it makes sense to modify things a bit, but right now my priority is to get all this working. Apparently, some feel that the ECMA spec has some problems with it which might have been patched[1], but I’m not sure exactly which.

Right now, I’m pretty close to having all the methods in place (after quite a few rewrites). The only thing I have not even started on is filtering. I have no actually tried to compile any of this, so that will be a whole task in itself. (BTW, you can see what I currently have done in the e4x branch.)

So here’s my current plan:
1. Finish up the methods (minus filtering) in the next day or two.
2. Sync up XML with the current FlexJS folder structure and get rid of some junk (like all the JXON classes).
3. Get this all to compile.
4. Figure out the whole filtering issue.
5. Create test cases.

Once this is done (or mostly done), it probably makes sense to get a sanity check and decide whether to rewrite some of what I’ve done.

Makes sense?

[1]https://bugs.chromium.org/p/v8/issues/detail?id=235#c75

On Feb 8, 2016, at 7:09 AM, Alex Harui <ah...@adobe.com> wrote:

> Harbs,
> 
> Is it possible you are being tricked by the difference between the XML
> length() method and the Object length property?  The following outputs 1
> for me:
> 
> var xml:XML = <node><child /></node>;
> 		trace(xml.length());
> 
> 
> AFAICT, the spec is recommending an internal implementation that is not
> quite a 1:1 mapping to the public API.  It suggests keeping an ordered
> list of child nodes based upon how the Insert function got called so that
> if there is a "get" with a numeric property name, there is a specific
> behavior (conversion to XMLList and subsequent access of the correct
> child).  It does not seem to specify that there are properties like [0],
> [1], [2] on the XML object itself.  Rather, the get function is called
> with a numeric property name.
> 
> I really hadn't looked at the spec in any great detail until tonight, but
> it made me wonder if FalconJX should be outputting calls to insert,
> replace, put, get, etc.  We would add some sort of prefix and/or suffix to
> the internal methods so they don't really appear in the public API.
> 
> Thoughts?
> -Alex
> 
> On 2/7/16, 9:38 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> Yeah. Except an XML object always has a length of 0… AFAIK, xmlObj[1]
>> always returns undefined. The only valid index on an XML object is 0
>> which returns the XML object (to blur the distinction between XMLList and
>> XML). I think xmlList[0] is the same as xmlList[0][0][0][0]...
>> 
>> I think I’m just going to ignore this part of the spec because I’m
>> storing everything in a _children array and dealing with that.
>> 
>> On Feb 7, 2016, at 6:59 PM, Andy Dufilie <an...@gmail.com> wrote:
>> 
>>> The insert code looks fine to me, assuming children of XML are stored as
>>> properties "0", "1", "2", ...
>>> It's shifting all children with index >= i and saving P starting at
>>> child
>>> index i.
>>> 
>>> [[Put]] is overwriting a child at a given index, and
>>> insertChildBefore/insertChildAfter/prependChild should be doing the same
>>> type of operation as insert.
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

Is it possible you are being tricked by the difference between the XML
length() method and the Object length property?  The following outputs 1
for me:

var xml:XML = <node><child /></node>;
		trace(xml.length());


AFAICT, the spec is recommending an internal implementation that is not
quite a 1:1 mapping to the public API.  It suggests keeping an ordered
list of child nodes based upon how the Insert function got called so that
if there is a "get" with a numeric property name, there is a specific
behavior (conversion to XMLList and subsequent access of the correct
child).  It does not seem to specify that there are properties like [0],
[1], [2] on the XML object itself.  Rather, the get function is called
with a numeric property name.

I really hadn't looked at the spec in any great detail until tonight, but
it made me wonder if FalconJX should be outputting calls to insert,
replace, put, get, etc.  We would add some sort of prefix and/or suffix to
the internal methods so they don't really appear in the public API.

Thoughts?
-Alex

On 2/7/16, 9:38 AM, "Harbs" <ha...@gmail.com> wrote:

>Yeah. Except an XML object always has a length of 0… AFAIK, xmlObj[1]
>always returns undefined. The only valid index on an XML object is 0
>which returns the XML object (to blur the distinction between XMLList and
>XML). I think xmlList[0] is the same as xmlList[0][0][0][0]...
>
>I think I’m just going to ignore this part of the spec because I’m
>storing everything in a _children array and dealing with that.
>
>On Feb 7, 2016, at 6:59 PM, Andy Dufilie <an...@gmail.com> wrote:
>
>> The insert code looks fine to me, assuming children of XML are stored as
>> properties "0", "1", "2", ...
>> It's shifting all children with index >= i and saving P starting at
>>child
>> index i.
>> 
>> [[Put]] is overwriting a child at a given index, and
>> insertChildBefore/insertChildAfter/prependChild should be doing the same
>> type of operation as insert.
>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Yeah. Except an XML object always has a length of 0… AFAIK, xmlObj[1] always returns undefined. The only valid index on an XML object is 0 which returns the XML object (to blur the distinction between XMLList and XML). I think xmlList[0] is the same as xmlList[0][0][0][0]...

I think I’m just going to ignore this part of the spec because I’m storing everything in a _children array and dealing with that.

On Feb 7, 2016, at 6:59 PM, Andy Dufilie <an...@gmail.com> wrote:

> The insert code looks fine to me, assuming children of XML are stored as
> properties "0", "1", "2", ...
> It's shifting all children with index >= i and saving P starting at child
> index i.
> 
> [[Put]] is overwriting a child at a given index, and
> insertChildBefore/insertChildAfter/prependChild should be doing the same
> type of operation as insert.


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Andy Dufilie <an...@gmail.com>.
The insert code looks fine to me, assuming children of XML are stored as
properties "0", "1", "2", ...
It's shifting all children with index >= i and saving P starting at child
index i.

[[Put]] is overwriting a child at a given index, and
insertChildBefore/insertChildAfter/prependChild should be doing the same
type of operation as insert.

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Here’s another issue I’m struggling with:

The ECMA spec has an [[Insert]] and [[Replace]] internal method defined for XML.

Here’s the semantics for [[Insert]]:
Semantics 
When the [[Insert]] method of an XML object x is called with property name P and value V, the following steps are taken: 
1. If x.[[Class]] ∈ {"text", "comment", "processing-instruction", "attribute"}, return 
2. Let i = ToUint32(P) 
3. If (ToString(i) is not equal to P), throw a TypeError exception 
4. If Type(V) is XML and (V is x or an ancestor of x) throw an Error exception 
5. Let n = 1 
6. If Type(V) is XMLList, let n = V.[[Length]] 
7. If n == 0, Return 
8. For j = x.[[Length]]-1 downto i, rename property ToString(j) of x to ToString(j + n) 
9. Let x.[[Length]] = x.[[Length]] + n 
10. If Type(V) is XMLList 
a. For j = 0 to V.[[Length-1]] 
i. V[j].[[Parent]] = x 
ii. x[i + j] = V[j] 
11. Else 
a. Call the [[Replace]] method of x with arguments i and V 
12. Return 
The [[Insert]] method is referenced a few places in the spec, but I’m really not sure how/why it’s defined as it is for XML objects (as opposed to XMLList objects). It kind of sounds like the contents of the XML object itself is redefined (as opposed to children). Why would you do that rather than [[Insert]] a child XML object into the parent and/or replace the child with a different one?

If my reading is right, I have no clue how to read the spec for [[Put]], insertChildBefore, insertChildAfter and prependChild. All those cases seem to be adding children.

Color me confused,
Harbs

On Jan 11, 2016, at 9:24 AM, Harbs <ha...@gmail.com> wrote:

> Thanks for that.
> 
> So: It looks like all items in xml get the parent namespaces associated with them as XML objects, but the namespaces are not written when using toXMLString().
> 
> Transferring an element with a namespace to another xml element loses the prefix and has an un-prefixed namespace applied to it.
> If the uri exists in the new element with a prefix, the element takes on the prefix of the new element.
> 
> 
> On Jan 11, 2016, at 5:21 AM, Andy Dufilie <an...@gmail.com> wrote:
> 
>> On Sun, Jan 10, 2016 at 4:53 PM, Harbs <ha...@gmail.com> wrote:
>> 
>>> I’m trying to figure out namespace behavior.
>>> 
>>> I’m probably tired, but can someone tell me why the  “catalog_item” var in
>>> this test (on line 70) does not get any results?
>>> 
>>> https://gist.github.com/Harbs/c24285b3af80eeed251d
>>> 
>> 
>> 
>> I put your code in an .as file instead of an .mxml, and it won't compile
>> because of this line:
>> 
>> var catalog_item = xml..fx::catalog_item[0];
>> 1120: Access of undefined property fx.
>> 
>> I think it's only a warning in MXML ("*possibly* undefined property")
>> because you've defined the fx namespace in the mxml tag at the top of the
>> file. To fix it, you either need to add the following to your code inside
>> CDATA:
>> 
>> namespace fx = 'http://ns.adobe.com/mxml/2009';
>> 
>> or use one of these forms:
>> 
>> var catalog_item = xml..('http://ns.adobe.com/mxml/2009')::catalog_item[0];
>> var catalog_item = xml.descendants(new QName('http://ns.adobe.com/mxml/2009',
>> 'catalog_item'))[0];
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Thanks for that.

So: It looks like all items in xml get the parent namespaces associated with them as XML objects, but the namespaces are not written when using toXMLString().

Transferring an element with a namespace to another xml element loses the prefix and has an un-prefixed namespace applied to it.
If the uri exists in the new element with a prefix, the element takes on the prefix of the new element.


On Jan 11, 2016, at 5:21 AM, Andy Dufilie <an...@gmail.com> wrote:

> On Sun, Jan 10, 2016 at 4:53 PM, Harbs <ha...@gmail.com> wrote:
> 
>> I’m trying to figure out namespace behavior.
>> 
>> I’m probably tired, but can someone tell me why the  “catalog_item” var in
>> this test (on line 70) does not get any results?
>> 
>> https://gist.github.com/Harbs/c24285b3af80eeed251d
>> 
> 
> 
> I put your code in an .as file instead of an .mxml, and it won't compile
> because of this line:
> 
> var catalog_item = xml..fx::catalog_item[0];
> 1120: Access of undefined property fx.
> 
> I think it's only a warning in MXML ("*possibly* undefined property")
> because you've defined the fx namespace in the mxml tag at the top of the
> file. To fix it, you either need to add the following to your code inside
> CDATA:
> 
> namespace fx = 'http://ns.adobe.com/mxml/2009';
> 
> or use one of these forms:
> 
> var catalog_item = xml..('http://ns.adobe.com/mxml/2009')::catalog_item[0];
> var catalog_item = xml.descendants(new QName('http://ns.adobe.com/mxml/2009',
> 'catalog_item'))[0];


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Andy Dufilie <an...@gmail.com>.
On Sun, Jan 10, 2016 at 4:53 PM, Harbs <ha...@gmail.com> wrote:

> I’m trying to figure out namespace behavior.
>
> I’m probably tired, but can someone tell me why the  “catalog_item” var in
> this test (on line 70) does not get any results?
>
> https://gist.github.com/Harbs/c24285b3af80eeed251d
>


I put your code in an .as file instead of an .mxml, and it won't compile
because of this line:

var catalog_item = xml..fx::catalog_item[0];
1120: Access of undefined property fx.

I think it's only a warning in MXML ("*possibly* undefined property")
because you've defined the fx namespace in the mxml tag at the top of the
file. To fix it, you either need to add the following to your code inside
CDATA:

namespace fx = 'http://ns.adobe.com/mxml/2009';

or use one of these forms:

var catalog_item = xml..('http://ns.adobe.com/mxml/2009')::catalog_item[0];
var catalog_item = xml.descendants(new QName('http://ns.adobe.com/mxml/2009',
'catalog_item'))[0];

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
I’m trying to figure out namespace behavior.

I’m probably tired, but can someone tell me why the  “catalog_item” var in this test (on line 70) does not get any results?

https://gist.github.com/Harbs/c24285b3af80eeed251d

On Jan 10, 2016, at 9:18 PM, Harbs <ha...@gmail.com> wrote:

> It’s kind of vague to me, but I’m assuming an InScopeNamespace means a namespace defined by an XML element, or one of its ancestors. I’m not entirely clear on all the nuances of namespace behavior in XML.
> 
> I’m not sure what happens when an element is moved from one XML object to another if it has a prefix, but no xmlns defined. I guess there needs to be some reference to the Namespace even though it’s not defined in the xml element? What happens if the prefix means one uri in one xml structure, but means another uri in another? Does it keep the prefix and have it redefined to a new uri, lose it, or does the same prefix mean different things in the same structure?
> 
> On Jan 10, 2016, at 6:21 PM, Alex Harui <ah...@adobe.com> wrote:
> 
>> 
>> 
>> On 1/10/16, 8:17 AM, "Harbs" <ha...@gmail.com> wrote:
>> 
>>> But it only removes it for the element it’s added to — not the children
>>> elements. (I think…)
>> 
>> I haven't read up on Inscope namespaces, but maybe it only applies to an
>> element?  Looks like each node (x) has its own list of inscopenamespaces.
>> 
>> -Alex
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 1/10/16, 11:18 AM, "Harbs" <ha...@gmail.com> wrote:

>It’s kind of vague to me, but I’m assuming an InScopeNamespace means a
>namespace defined by an XML element, or one of its ancestors. I’m not
>entirely clear on all the nuances of namespace behavior in XML.

Neither am I.  Running some tests might help.

>
>I’m not sure what happens when an element is moved from one XML object to
>another if it has a prefix, but no xmlns defined. I guess there needs to
>be some reference to the Namespace even though it’s not defined in the
>xml element? What happens if the prefix means one uri in one xml
>structure, but means another uri in another? Does it keep the prefix and
>have it redefined to a new uri, lose it, or does the same prefix mean
>different things in the same structure?

I don't know for sure, but I had to implement E4X, each node would store a
qname.   The prefix would be used as a shortcut for a namespace if it had
been specified via xmlns.  If there wasn't a prefix, then I would write
out the URI for the namespace when printing via toXMLString().

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
It’s kind of vague to me, but I’m assuming an InScopeNamespace means a namespace defined by an XML element, or one of its ancestors. I’m not entirely clear on all the nuances of namespace behavior in XML.

I’m not sure what happens when an element is moved from one XML object to another if it has a prefix, but no xmlns defined. I guess there needs to be some reference to the Namespace even though it’s not defined in the xml element? What happens if the prefix means one uri in one xml structure, but means another uri in another? Does it keep the prefix and have it redefined to a new uri, lose it, or does the same prefix mean different things in the same structure?

On Jan 10, 2016, at 6:21 PM, Alex Harui <ah...@adobe.com> wrote:

> 
> 
> On 1/10/16, 8:17 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> But it only removes it for the element it’s added to — not the children
>> elements. (I think…)
> 
> I haven't read up on Inscope namespaces, but maybe it only applies to an
> element?  Looks like each node (x) has its own list of inscopenamespaces.
> 
> -Alex
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 1/10/16, 8:17 AM, "Harbs" <ha...@gmail.com> wrote:

>But it only removes it for the element it’s added to — not the children
>elements. (I think…)

I haven't read up on Inscope namespaces, but maybe it only applies to an
element?  Looks like each node (x) has its own list of inscopenamespaces.

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
But it only removes it for the element it’s added to — not the children elements. (I think…)

On Jan 10, 2016, at 5:42 PM, Alex Harui <ah...@adobe.com> wrote:

> 
> 
> On 1/10/16, 7:35 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> Here’s an item in the spec which I’m having trouble understanding:
>> 
>> When the [[AddInScopeNamespace]] method of an XML object x is called with
>> a namespace N, the following steps are taken:
>> 1. If x.[[Class]] ∈ {"text", "comment", "processing-instruction",
>> “attribute”}, return
>> 2. If N.prefix != undefined
>> a. If N.prefix == "" and x.[[Name]].uri == "", return
>> b. Let match be null
>> c. For each ns in x.[[InScopeNamespaces]]
>>   i. If N.prefix == ns.prefix, let match = ns
>> d. If match is not null and match.uri is not equal to N.uri
>>   i. Remove match from x.[[InScopeNamespaces]]
>> e. Let x.[[InScopeNamespaces]] = x.[[InScopeNamespaces]] ∪ { N }
>> f. If x.[[Name]].[[Prefix]] == N.prefix
>>   i. Let x.[[Name]].prefix = undefined
>> g. For each attr in x.[[Attributes]]
>>   i. If attr.[[Name]].[[Prefix]] == N.prefix, let attr.[[Name]].prefix
>> = undefined
>> 3. Return
>> 
>> I do not understand e through g. It looks like the spec says you are
>> supposed to remove the prefixes of the XML which has the namespace added
>> to it if the prefix matches the added namespace. Why would you do that?
> 
> I don't know for sure.  Maybe because they are now in scope, a prefix is
> no longer needed?
> 
> -Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 1/10/16, 7:35 AM, "Harbs" <ha...@gmail.com> wrote:

>Here’s an item in the spec which I’m having trouble understanding:
>
>When the [[AddInScopeNamespace]] method of an XML object x is called with
>a namespace N, the following steps are taken:
>1. If x.[[Class]] ∈ {"text", "comment", "processing-instruction",
>“attribute”}, return
>2. If N.prefix != undefined
>  a. If N.prefix == "" and x.[[Name]].uri == "", return
>  b. Let match be null
>  c. For each ns in x.[[InScopeNamespaces]]
>    i. If N.prefix == ns.prefix, let match = ns
>  d. If match is not null and match.uri is not equal to N.uri
>    i. Remove match from x.[[InScopeNamespaces]]
>  e. Let x.[[InScopeNamespaces]] = x.[[InScopeNamespaces]] ∪ { N }
>  f. If x.[[Name]].[[Prefix]] == N.prefix
>    i. Let x.[[Name]].prefix = undefined
>  g. For each attr in x.[[Attributes]]
>    i. If attr.[[Name]].[[Prefix]] == N.prefix, let attr.[[Name]].prefix
>= undefined
>3. Return
>
>I do not understand e through g. It looks like the spec says you are
>supposed to remove the prefixes of the XML which has the namespace added
>to it if the prefix matches the added namespace. Why would you do that?

I don't know for sure.  Maybe because they are now in scope, a prefix is
no longer needed?

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Here’s an item in the spec which I’m having trouble understanding:

When the [[AddInScopeNamespace]] method of an XML object x is called with a namespace N, the following steps are taken:
1. If x.[[Class]] ∈ {"text", "comment", "processing-instruction", “attribute”}, return
2. If N.prefix != undefined
  a. If N.prefix == "" and x.[[Name]].uri == "", return
  b. Let match be null
  c. For each ns in x.[[InScopeNamespaces]]
    i. If N.prefix == ns.prefix, let match = ns
  d. If match is not null and match.uri is not equal to N.uri
    i. Remove match from x.[[InScopeNamespaces]]
  e. Let x.[[InScopeNamespaces]] = x.[[InScopeNamespaces]] ∪ { N }
  f. If x.[[Name]].[[Prefix]] == N.prefix
    i. Let x.[[Name]].prefix = undefined
  g. For each attr in x.[[Attributes]]
    i. If attr.[[Name]].[[Prefix]] == N.prefix, let attr.[[Name]].prefix = undefined
3. Return

I do not understand e through g. It looks like the spec says you are supposed to remove the prefixes of the XML which has the namespace added to it if the prefix matches the added namespace. Why would you do that?

On Jan 7, 2016, at 11:53 PM, Harbs <ha...@gmail.com> wrote:

> Next item:
> 
> I’m working on namespaces and QNames.
> 
> E4X allows the specification of default namespaces like this:
> 
> default xml namespace = "http://ns.adobe.com/mxml/2009”;
> 
> This causes all elements created after this statement to act as if they were declared like this:
> <elem xmlns="http://ns.adobe.com/mxml/2009”/> (notice, no prefix)
> 
> I’m not sure how commonly used this feature is, but we should probably map this statement to some kind of static method. We can either attach it to XML, or Namespace.
> 
> (I’ve learned more than I care to know about E4X in the past few weeks. I have the E4X spec coming out of my ears…) ;-)
> 
> On Jan 5, 2016, at 7:12 PM, Alex Harui <ah...@adobe.com> wrote:
> 
>> 
>> 
>> On 1/5/16, 7:49 AM, "Harbs" <ha...@gmail.com> wrote:
>> 
>>> BTW, I’m not sure what we said about myXML.@foo = “baz” or myXML.@ba:foo
>>> = “baz”.
>>> 
>>> Are we mapping that to myXML.setChild(“@foo”,”baz”) and
>>> myXML.setChild(“@ba:foo”,”baz”), or are we creating a separate function
>>> for attributes?
>> 
>> I tried it and got an exception.  So I just pushed a fix for that where it
>> will call
>> 
>>   myXML.setAttribute(“foo”,”baz”)
>> 
>> 
>> I'm going to spend some time on XML and the compiler today.
>> 
>> -Alex
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Next item:

I’m working on namespaces and QNames.

E4X allows the specification of default namespaces like this:

default xml namespace = "http://ns.adobe.com/mxml/2009”;

This causes all elements created after this statement to act as if they were declared like this:
<elem xmlns="http://ns.adobe.com/mxml/2009”/> (notice, no prefix)

I’m not sure how commonly used this feature is, but we should probably map this statement to some kind of static method. We can either attach it to XML, or Namespace.

(I’ve learned more than I care to know about E4X in the past few weeks. I have the E4X spec coming out of my ears…) ;-)

On Jan 5, 2016, at 7:12 PM, Alex Harui <ah...@adobe.com> wrote:

> 
> 
> On 1/5/16, 7:49 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> BTW, I’m not sure what we said about myXML.@foo = “baz” or myXML.@ba:foo
>> = “baz”.
>> 
>> Are we mapping that to myXML.setChild(“@foo”,”baz”) and
>> myXML.setChild(“@ba:foo”,”baz”), or are we creating a separate function
>> for attributes?
> 
> I tried it and got an exception.  So I just pushed a fix for that where it
> will call
> 
>   myXML.setAttribute(“foo”,”baz”)
> 
> 
> I'm going to spend some time on XML and the compiler today.
> 
> -Alex
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 1/5/16, 7:49 AM, "Harbs" <ha...@gmail.com> wrote:

>BTW, I’m not sure what we said about myXML.@foo = “baz” or myXML.@ba:foo
>= “baz”.
>
>Are we mapping that to myXML.setChild(“@foo”,”baz”) and
>myXML.setChild(“@ba:foo”,”baz”), or are we creating a separate function
>for attributes?

I tried it and got an exception.  So I just pushed a fix for that where it
will call

   myXML.setAttribute(“foo”,”baz”)


I'm going to spend some time on XML and the compiler today.

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
BTW, I’m not sure what we said about myXML.@foo = “baz” or myXML.@ba:foo = “baz”.

Are we mapping that to myXML.setChild(“@foo”,”baz”) and myXML.setChild(“@ba:foo”,”baz”), or are we creating a separate function for attributes?

On Jan 5, 2016, at 5:07 PM, Harbs <ha...@gmail.com> wrote:

> Yes. I’m using DOMParser.parseFromString() to parse the XML. After the XML is parsed into DOM elements, I’m walking that to create the XML structure.
> 
> Although, I’m beginning to wonder if it makes more sense to just write my own state machine to walk the XML and build the structure on my own.
> 
> On Jan 5, 2016, at 4:53 PM, Andy Dufilie <an...@gmail.com> wrote:
> 
>> On Tue, Jan 5, 2016 at 9:37 AM, Harbs <ha...@gmail.com> wrote:
>> 
>>> That’s not going to work if you need to implement toXMLString().
>>> 
>>> Imagine an mxml file where all the CDATA becomes escaped text. It’s not
>>> going to work very well… ;-) The same goes for lots of other XML file uses.
>>> 
>>> Apparently this recommendation for DOM4 is not gonna happen, so we’re
>>> good.[1]
>>> 
>>> [1]https://github.com/whatwg/dom/issues/142
>>> 
>>> 
>> That's good news.  However, I don't think toXMLString() would be a problem
>> since you have to support escaped text anyway.  Yes, it would be different
>> from having the CDATA tag, but you would not lose any information other
>> than the fact that there was a CDATA tag originally used to encode the
>> text.  The removal of CDATA was specific to HTML, not XML in general, and
>> you can't put XML literals in JavaScript code anyway.  Are you using a
>> built-in JavaScript feature to parse the XML string and it doesn't support
>> CDATA?
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Yes. I’m using DOMParser.parseFromString() to parse the XML. After the XML is parsed into DOM elements, I’m walking that to create the XML structure.

Although, I’m beginning to wonder if it makes more sense to just write my own state machine to walk the XML and build the structure on my own.

On Jan 5, 2016, at 4:53 PM, Andy Dufilie <an...@gmail.com> wrote:

> On Tue, Jan 5, 2016 at 9:37 AM, Harbs <ha...@gmail.com> wrote:
> 
>> That’s not going to work if you need to implement toXMLString().
>> 
>> Imagine an mxml file where all the CDATA becomes escaped text. It’s not
>> going to work very well… ;-) The same goes for lots of other XML file uses.
>> 
>> Apparently this recommendation for DOM4 is not gonna happen, so we’re
>> good.[1]
>> 
>> [1]https://github.com/whatwg/dom/issues/142
>> 
>> 
> That's good news.  However, I don't think toXMLString() would be a problem
> since you have to support escaped text anyway.  Yes, it would be different
> from having the CDATA tag, but you would not lose any information other
> than the fact that there was a CDATA tag originally used to encode the
> text.  The removal of CDATA was specific to HTML, not XML in general, and
> you can't put XML literals in JavaScript code anyway.  Are you using a
> built-in JavaScript feature to parse the XML string and it doesn't support
> CDATA?


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Andy Dufilie <an...@gmail.com>.
On Tue, Jan 5, 2016 at 9:37 AM, Harbs <ha...@gmail.com> wrote:

> That’s not going to work if you need to implement toXMLString().
>
> Imagine an mxml file where all the CDATA becomes escaped text. It’s not
> going to work very well… ;-) The same goes for lots of other XML file uses.
>
> Apparently this recommendation for DOM4 is not gonna happen, so we’re
> good.[1]
>
> [1]https://github.com/whatwg/dom/issues/142
>
>
That's good news.  However, I don't think toXMLString() would be a problem
since you have to support escaped text anyway.  Yes, it would be different
from having the CDATA tag, but you would not lose any information other
than the fact that there was a CDATA tag originally used to encode the
text.  The removal of CDATA was specific to HTML, not XML in general, and
you can't put XML literals in JavaScript code anyway.  Are you using a
built-in JavaScript feature to parse the XML string and it doesn't support
CDATA?

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
That’s not going to work if you need to implement toXMLString().

Imagine an mxml file where all the CDATA becomes escaped text. It’s not going to work very well… ;-) The same goes for lots of other XML file uses.

Apparently this recommendation for DOM4 is not gonna happen, so we’re good.[1]

[1]https://github.com/whatwg/dom/issues/142

On Jan 5, 2016, at 4:20 PM, Andy Dufilie <an...@gmail.com> wrote:

> On Tue, Jan 5, 2016 at 7:10 AM, Harbs <ha...@gmail.com> wrote:
> 
>> I cannot find a recommended way to handle CDATA in  the DOM4 spec.[3]
>> 
>> Does anyone have a recommendation o how to handle this?
>> 
> 
> In place of a CDATA text section you can just escape the text using xml
> escaping.


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Andy Dufilie <an...@gmail.com>.
On Tue, Jan 5, 2016 at 7:10 AM, Harbs <ha...@gmail.com> wrote:

> I cannot find a recommended way to handle CDATA in  the DOM4 spec.[3]
>
> Does anyone have a recommendation o how to handle this?
>

In place of a CDATA text section you can just escape the text using xml
escaping.

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Next issue:

I think some people in W3C should have their heads examined. Why in the world are they removing useful features???

The only way I can find to access CDATA in Document is with CDataSections[1] and the nodeType: Node.CDATA_SECTION_NODE[2]

I cannot find a recommended way to handle CDATA in  the DOM4 spec.[3]

Does anyone have a recommendation o how to handle this?

[1]https://developer.mozilla.org/en-US/docs/Web/API/CDATASection
[2]https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
[3]https://dom.spec.whatwg.org/

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Here’s all the details from the E4X spec:

Expressions may be used to compute parts of an XML initialiser. Expressions are delimited by curly braces and may appear inside tags or element content. Inside a tag, expressions may be used to compute a tag name, attribute name, or attribute value. Inside an element, expressions may be used to compute element content. For example, 
for (var i = 0; i < 10; i++) 
e[i] = <employee id={i}> // compute id value 
<name>{names[i].toUpperCase()}</name> // compute name value 
<age>{ages[i]}</age> // compute age value 
</employee>; 
Each expression is evaluated and replaced by its value prior to parsing the literal XML value. For example the following expression, 
var tagname = "name"; 
var attributename = "id"; 
var attributevalue = 5; 
var content = "Fred"; 
var x = <{tagname} {attributename}={attributevalue}>{content}</{tagname}>; 
would assign the following XML value to the variable x. 
<name id="5">Fred</name> 

I’m pretty sure that the only place a curly brace literal is legal is in a CDATA block.


On Jan 4, 2016, at 7:27 PM, Alex Harui <ah...@adobe.com> wrote:

> 
> 
> On 1/4/16, 8:17 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> For literals, yes, we’d for the most part just pass the whole thing as a
>> string to the constructor. The only exception I can think of is bracket
>> notation:
>> 
>> var foo:XML = <node><subnode attr={myAttr}>foo</subnode></node>;
>> would have to become:
>> var foo:XML = new XML('<node><subnode
>> attr="‘+myAttr+’">foo</subnode></node>’);
> 
> Wow, didn't know about that capability.  I'll have to see what the parser
> knows about that.
> 
> -Alex
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 1/4/16, 8:17 AM, "Harbs" <ha...@gmail.com> wrote:

>For literals, yes, we’d for the most part just pass the whole thing as a
>string to the constructor. The only exception I can think of is bracket
>notation:
>
>var foo:XML = <node><subnode attr={myAttr}>foo</subnode></node>;
>would have to become:
>var foo:XML = new XML('<node><subnode
>attr="‘+myAttr+’">foo</subnode></node>’);

Wow, didn't know about that capability.  I'll have to see what the parser
knows about that.

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Andy Dufilie <an...@gmail.com>.
On Mon, Jan 4, 2016 at 11:17 AM, Harbs <ha...@gmail.com> wrote:

> For literals, yes, we’d for the most part just pass the whole thing as a
> string to the constructor. The only exception I can think of is bracket
> notation:
>
> var foo:XML = <node><subnode attr={myAttr}>foo</subnode></node>;
> would have to become:
> var foo:XML = new XML('<node><subnode
> attr="‘+myAttr+’">foo</subnode></node>’);
>
> Wrapping the xml in a dummy node is a good idea. I like that. Thanks!
>

Another thing you may want to consider is the new back-tick quotes (` `) in
ES6:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/template_strings

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
For literals, yes, we’d for the most part just pass the whole thing as a string to the constructor. The only exception I can think of is bracket notation:

var foo:XML = <node><subnode attr={myAttr}>foo</subnode></node>;
would have to become:
var foo:XML = new XML('<node><subnode attr="‘+myAttr+’">foo</subnode></node>’);

Wrapping the xml in a dummy node is a good idea. I like that. Thanks!

On Jan 4, 2016, at 6:08 PM, Alex Harui <ah...@adobe.com> wrote:

> Looks like there currently isn't any XML Literal handling for AS -> JS.
> 
> For AS code like:
> 
> var foo:XML = <node><subnode attr="1">foo</subnode></node>;
> 
> What do you want the output to be?  Shouldn't we just pass the whole thing
> to the XML() function?
> 
> var foo = new XML('<node><subnode attr="1">foo</subnode></node>');
> 
> Or do you want something else?
> 
> For XMLList literals, can you just wrap it in a dummy node and let JS
> parse it?
> 
>  var bar:XMLList = new XMLList("<node attr='1' /><node attr='2' />");
> 
> Is that the same as:
> 
>  var bar:XMLList = new XML("<dummy><node attr='1' /><node attr='2'
> /></dummy>").children();
> 
> -Alex
> 
> On 1/4/16, 8:00 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> Here’s an implementation question:
>> 
>> Apparently, it’s possible to pass a string into an XMLList constructor to
>> create an XMLList of multiple XML objects. I’m not sure of the best way
>> to handle this.
>> 
>> I can walk the contents of the string and split the string into multiple
>> XML strings and create separate XML objects from that, but I’m concerned
>> that it might be error-prone. Does anyone know of a cheap method of
>> parsing a string into multiple nodes in standard javascript?
>> 
>> On Jan 4, 2016, at 5:06 PM, Harbs <ha...@gmail.com> wrote:
>> 
>>> Another issue:
>>> 
>>> XML literals and angle brackets.
>>> 
>>> Is the compiler handling xml literals at all now? I think angle bracket
>>> notation need to be converted to string concatenation as well.
>>> 
>>> On Dec 31, 2015, at 5:21 PM, Alex Harui <ah...@adobe.com> wrote:
>>> 
>>>> Sounds reasonable.  Do you want to try to make the changes to the
>>>> compiler
>>>> yourself?
>>>> 
>>>> I think you can just copy the pattern in this commit:
>>>> 22fa6defa3ed2896de4eba1a5a1b316e1e3c2b0f
>>>> In these files: BinaryOperatorEmitter.java and
>>>> TestFlexJSGlobalClasses.java
>>>> 
>>>> -Alex
>>>> 
>>>> On 12/31/15, 1:02 AM, "Harbs" <ha...@gmail.com> wrote:
>>>> 
>>>>> Another question:
>>>>> 
>>>>> How should we handle equality? According to the E4X spec, if regular
>>>>> equality is used, it returns true if the structure of the XML matches
>>>>> even if the objects are different objects. So:
>>>>> 
>>>>> var xml1 = <foo><baz /></foo>;
>>>>> var xml2 = <foo><baz/></foo>;
>>>>> xml1 == xml2 // true
>>>>> xml1 === xml2 // false
>>>>> xml1 === xml1 // true
>>>>> var xml1 = <foo><baz /></foo>;
>>>>> var xml2 = <foo><baz name="baz"/></foo>;
>>>>> xml1 == xml2 // false
>>>>> xml1 === xml2 // false
>>>>> xml1 === xml1 // true
>>>>> 
>>>>> I’m thinking I should add an equals(xml) method which you’d map to the
>>>>> “==" operator.
>>>> 
>>> 
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Alex Harui <ah...@adobe.com>.
Looks like there currently isn't any XML Literal handling for AS -> JS.

For AS code like:

 var foo:XML = <node><subnode attr="1">foo</subnode></node>;

What do you want the output to be?  Shouldn't we just pass the whole thing
to the XML() function?

 var foo = new XML('<node><subnode attr="1">foo</subnode></node>');

Or do you want something else?

For XMLList literals, can you just wrap it in a dummy node and let JS
parse it?

  var bar:XMLList = new XMLList("<node attr='1' /><node attr='2' />");

Is that the same as:

  var bar:XMLList = new XML("<dummy><node attr='1' /><node attr='2'
/></dummy>").children();

-Alex

On 1/4/16, 8:00 AM, "Harbs" <ha...@gmail.com> wrote:

>Here’s an implementation question:
>
>Apparently, it’s possible to pass a string into an XMLList constructor to
>create an XMLList of multiple XML objects. I’m not sure of the best way
>to handle this.
>
>I can walk the contents of the string and split the string into multiple
>XML strings and create separate XML objects from that, but I’m concerned
>that it might be error-prone. Does anyone know of a cheap method of
>parsing a string into multiple nodes in standard javascript?
>
>On Jan 4, 2016, at 5:06 PM, Harbs <ha...@gmail.com> wrote:
>
>> Another issue:
>> 
>> XML literals and angle brackets.
>> 
>> Is the compiler handling xml literals at all now? I think angle bracket
>>notation need to be converted to string concatenation as well.
>> 
>> On Dec 31, 2015, at 5:21 PM, Alex Harui <ah...@adobe.com> wrote:
>> 
>>> Sounds reasonable.  Do you want to try to make the changes to the
>>>compiler
>>> yourself?
>>> 
>>> I think you can just copy the pattern in this commit:
>>> 22fa6defa3ed2896de4eba1a5a1b316e1e3c2b0f
>>> In these files: BinaryOperatorEmitter.java and
>>>TestFlexJSGlobalClasses.java
>>> 
>>> -Alex
>>> 
>>> On 12/31/15, 1:02 AM, "Harbs" <ha...@gmail.com> wrote:
>>> 
>>>> Another question:
>>>> 
>>>> How should we handle equality? According to the E4X spec, if regular
>>>> equality is used, it returns true if the structure of the XML matches
>>>> even if the objects are different objects. So:
>>>> 
>>>> var xml1 = <foo><baz /></foo>;
>>>> var xml2 = <foo><baz/></foo>;
>>>> xml1 == xml2 // true
>>>> xml1 === xml2 // false
>>>> xml1 === xml1 // true
>>>> var xml1 = <foo><baz /></foo>;
>>>> var xml2 = <foo><baz name="baz"/></foo>;
>>>> xml1 == xml2 // false
>>>> xml1 === xml2 // false
>>>> xml1 === xml1 // true
>>>> 
>>>> I’m thinking I should add an equals(xml) method which you’d map to the
>>>> “==" operator.
>>> 
>> 
>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Here’s an implementation question:

Apparently, it’s possible to pass a string into an XMLList constructor to create an XMLList of multiple XML objects. I’m not sure of the best way to handle this.

I can walk the contents of the string and split the string into multiple XML strings and create separate XML objects from that, but I’m concerned that it might be error-prone. Does anyone know of a cheap method of parsing a string into multiple nodes in standard javascript?

On Jan 4, 2016, at 5:06 PM, Harbs <ha...@gmail.com> wrote:

> Another issue:
> 
> XML literals and angle brackets.
> 
> Is the compiler handling xml literals at all now? I think angle bracket notation need to be converted to string concatenation as well.
> 
> On Dec 31, 2015, at 5:21 PM, Alex Harui <ah...@adobe.com> wrote:
> 
>> Sounds reasonable.  Do you want to try to make the changes to the compiler
>> yourself?
>> 
>> I think you can just copy the pattern in this commit:
>> 22fa6defa3ed2896de4eba1a5a1b316e1e3c2b0f
>> In these files: BinaryOperatorEmitter.java and TestFlexJSGlobalClasses.java
>> 
>> -Alex
>> 
>> On 12/31/15, 1:02 AM, "Harbs" <ha...@gmail.com> wrote:
>> 
>>> Another question:
>>> 
>>> How should we handle equality? According to the E4X spec, if regular
>>> equality is used, it returns true if the structure of the XML matches
>>> even if the objects are different objects. So:
>>> 
>>> var xml1 = <foo><baz /></foo>;
>>> var xml2 = <foo><baz/></foo>;
>>> xml1 == xml2 // true
>>> xml1 === xml2 // false
>>> xml1 === xml1 // true
>>> var xml1 = <foo><baz /></foo>;
>>> var xml2 = <foo><baz name="baz"/></foo>;
>>> xml1 == xml2 // false
>>> xml1 === xml2 // false
>>> xml1 === xml1 // true
>>> 
>>> I’m thinking I should add an equals(xml) method which you’d map to the
>>> “==" operator.
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Another issue:

XML literals and angle brackets.

Is the compiler handling xml literals at all now? I think angle bracket notation need to be converted to string concatenation as well.

On Dec 31, 2015, at 5:21 PM, Alex Harui <ah...@adobe.com> wrote:

> Sounds reasonable.  Do you want to try to make the changes to the compiler
> yourself?
> 
> I think you can just copy the pattern in this commit:
> 22fa6defa3ed2896de4eba1a5a1b316e1e3c2b0f
> In these files: BinaryOperatorEmitter.java and TestFlexJSGlobalClasses.java
> 
> -Alex
> 
> On 12/31/15, 1:02 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> Another question:
>> 
>> How should we handle equality? According to the E4X spec, if regular
>> equality is used, it returns true if the structure of the XML matches
>> even if the objects are different objects. So:
>> 
>> var xml1 = <foo><baz /></foo>;
>> var xml2 = <foo><baz/></foo>;
>> xml1 == xml2 // true
>> xml1 === xml2 // false
>> xml1 === xml1 // true
>> var xml1 = <foo><baz /></foo>;
>> var xml2 = <foo><baz name="baz"/></foo>;
>> xml1 == xml2 // false
>> xml1 === xml2 // false
>> xml1 === xml1 // true
>> 
>> I’m thinking I should add an equals(xml) method which you’d map to the
>> “==" operator.
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 1/1/16, 2:18 AM, "Harbs" <ha...@gmail.com> wrote:

>Looking at the code, it looks to me like
>((JSFlexJSEmitter)getEmitter()).isXMLList() returns true if it’s either
>XML OR XMLList. Is that right?

Yes.  I think that method probably should be renamed.

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Looking at the code, it looks to me like ((JSFlexJSEmitter)getEmitter()).isXMLList() returns true if it’s either XML OR XMLList. Is that right?

On Dec 31, 2015, at 6:45 PM, Harbs <ha...@gmail.com> wrote:

> OK. Sounds like a fun challenge. I guess it’s not a bad idea to get my feet wet… ;-)
> 
> On Dec 31, 2015, at 5:21 PM, Alex Harui <ah...@adobe.com> wrote:
> 
>> Sounds reasonable.  Do you want to try to make the changes to the compiler
>> yourself?
>> 
>> I think you can just copy the pattern in this commit:
>> 22fa6defa3ed2896de4eba1a5a1b316e1e3c2b0f
>> In these files: BinaryOperatorEmitter.java and TestFlexJSGlobalClasses.java
>> 
>> -Alex
>> 
>> On 12/31/15, 1:02 AM, "Harbs" <ha...@gmail.com> wrote:
>> 
>>> Another question:
>>> 
>>> How should we handle equality? According to the E4X spec, if regular
>>> equality is used, it returns true if the structure of the XML matches
>>> even if the objects are different objects. So:
>>> 
>>> var xml1 = <foo><baz /></foo>;
>>> var xml2 = <foo><baz/></foo>;
>>> xml1 == xml2 // true
>>> xml1 === xml2 // false
>>> xml1 === xml1 // true
>>> var xml1 = <foo><baz /></foo>;
>>> var xml2 = <foo><baz name="baz"/></foo>;
>>> xml1 == xml2 // false
>>> xml1 === xml2 // false
>>> xml1 === xml1 // true
>>> 
>>> I’m thinking I should add an equals(xml) method which you’d map to the
>>> “==" operator.
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
OK. Sounds like a fun challenge. I guess it’s not a bad idea to get my feet wet… ;-)

On Dec 31, 2015, at 5:21 PM, Alex Harui <ah...@adobe.com> wrote:

> Sounds reasonable.  Do you want to try to make the changes to the compiler
> yourself?
> 
> I think you can just copy the pattern in this commit:
> 22fa6defa3ed2896de4eba1a5a1b316e1e3c2b0f
> In these files: BinaryOperatorEmitter.java and TestFlexJSGlobalClasses.java
> 
> -Alex
> 
> On 12/31/15, 1:02 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> Another question:
>> 
>> How should we handle equality? According to the E4X spec, if regular
>> equality is used, it returns true if the structure of the XML matches
>> even if the objects are different objects. So:
>> 
>> var xml1 = <foo><baz /></foo>;
>> var xml2 = <foo><baz/></foo>;
>> xml1 == xml2 // true
>> xml1 === xml2 // false
>> xml1 === xml1 // true
>> var xml1 = <foo><baz /></foo>;
>> var xml2 = <foo><baz name="baz"/></foo>;
>> xml1 == xml2 // false
>> xml1 === xml2 // false
>> xml1 === xml1 // true
>> 
>> I’m thinking I should add an equals(xml) method which you’d map to the
>> “==" operator.
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Alex Harui <ah...@adobe.com>.
Sounds reasonable.  Do you want to try to make the changes to the compiler
yourself?

I think you can just copy the pattern in this commit:
22fa6defa3ed2896de4eba1a5a1b316e1e3c2b0f
In these files: BinaryOperatorEmitter.java and TestFlexJSGlobalClasses.java

-Alex

On 12/31/15, 1:02 AM, "Harbs" <ha...@gmail.com> wrote:

>Another question:
>
>How should we handle equality? According to the E4X spec, if regular
>equality is used, it returns true if the structure of the XML matches
>even if the objects are different objects. So:
>
>var xml1 = <foo><baz /></foo>;
>var xml2 = <foo><baz/></foo>;
>xml1 == xml2 // true
>xml1 === xml2 // false
>xml1 === xml1 // true
>var xml1 = <foo><baz /></foo>;
>var xml2 = <foo><baz name="baz"/></foo>;
>xml1 == xml2 // false
>xml1 === xml2 // false
>xml1 === xml1 // true
>
>I’m thinking I should add an equals(xml) method which you’d map to the
>“==" operator.


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Another question:

How should we handle equality? According to the E4X spec, if regular equality is used, it returns true if the structure of the XML matches even if the objects are different objects. So:

var xml1 = <foo><baz /></foo>;
var xml2 = <foo><baz/></foo>;
xml1 == xml2 // true
xml1 === xml2 // false
xml1 === xml1 // true
var xml1 = <foo><baz /></foo>;
var xml2 = <foo><baz name="baz"/></foo>;
xml1 == xml2 // false
xml1 === xml2 // false
xml1 === xml1 // true

I’m thinking I should add an equals(xml) method which you’d map to the “==" operator.

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 12/30/15, 11:59 AM, "Harbs" <ha...@gmail.com> wrote:

>So, myXML.dim:baz = foo:
>while compile to myXML.setChild(“dim:baz”,foo)
>
>Right?
>
>If so, I can handle that.

I haven't tried namespaces, but I would expect that to be the desired
result.

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
So, myXML.dim:baz = foo:
while compile to myXML.setChild(“dim:baz”,foo)

Right?

If so, I can handle that.

On Dec 30, 2015, at 8:02 PM, Alex Harui <ah...@adobe.com> wrote:

> 
> 
> On 12/30/15, 9:16 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> And I’m assuming the signature will be something like this:
>> setChild(nameOrQualifiedName:String,xmlOrXmlList:Object)
> 
> AS: myXML.someChild = someXMLorXMLList;
> 
> JS: myXML.setChild('someChild', someXMLorXMLList);
> 
> No idea of that actually is the case or not, I'm just looking at the
> compiler source ;-).  And we can change it if you want.
> 
> -Alex
> 
>> 
>> On Dec 30, 2015, at 6:13 PM, Harbs <ha...@gmail.com> wrote:
>> 
>>> OK. I think we discussed this, but it’s been a few weeks… ;-)
>>> 
>>> The method will accept either an XML or XMLList object.
>>> 
>>> On Dec 30, 2015, at 5:20 PM, Alex Harui <ah...@adobe.com> wrote:
>>> 
>>>> For assignment, there will be a call to setChild().
>>>> 
>>>> On 12/30/15, 3:09 AM, "Harbs" <ha...@gmail.com> wrote:
>>>> 
>>>>> The past month or so, I’ve been side-tracked with lots of things, but
>>>>> I’m
>>>>> finally back on this.
>>>>> 
>>>>> I’m not sure what we decided in terms of assignment. AFAIK, there’s no
>>>>> assignment method in XML for replacing XML with a specific name with
>>>>> an
>>>>> XMLList. The closest we have is replace() which takes an XML object
>>>>> and
>>>>> not an XMLLIst. I’m not even sure what it does. (I guess I can try it
>>>>> and
>>>>> see.)
>>>>> 
>>>>> Harbs
>>>>> 
>>>>> On Nov 19, 2015, at 9:06 AM, Alex Harui <ah...@adobe.com> wrote:
>>>>> 
>>>>>> OK, I've pushed changes that handle basic for loops and setting
>>>>>> properties.  And even += on XMLLists.
>>>>>> 
>>>>>> You can get a sense of what works by looking at the unit tests in
>>>>>> 
>>>>>> 
>>>>>> compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/fle
>>>>>> xjs
>>>>>> /T
>>>>>> estFlexJSGlobalClasses.java
>>>>>> 
>>>>>> 
>>>>>> I'm sure there are lots of cases I haven't thought of, but it will
>>>>>> hopefully get you started.
>>>>>> 
>>>>>> -Alex
>>>>>> 
>>>>>> On 11/18/15, 3:12 PM, "Alex Harui" <ah...@adobe.com> wrote:
>>>>>> 
>>>>>>> I pushed changes to not use _as3_ on XML function calls and use
>>>>>>> child()
>>>>>>> for "." access.
>>>>>>> 
>>>>>>> I'm going to look into:
>>>>>>> -for and foreach
>>>>>>> -setting properties on XML/XMLList
>>>>>>> 
>>>>>>> -Alex
>>>>>>> 
>>>>>>> On 11/16/15, 11:47 AM, "Alex Harui" <ah...@adobe.com> wrote:
>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> On 11/16/15, 11:43 AM, "Harbs" <ha...@gmail.com> wrote:
>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> On Nov 16, 2015, at 9:40 PM, Harbs <ha...@gmail.com> wrote:
>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> On Nov 16, 2015, at 9:14 PM, Alex Harui <ah...@adobe.com> wrote:
>>>>>>>>>> 
>>>>>>>>>>> Hmm.  I wonder what other operators work.  Like “-=“.
>>>>>>>>>> 
>>>>>>>>>> It looks like -= does not work.
>>>>>>>>>> 
>>>>>>>>>>> And does xmlList1 + xmlList2 concatenate them?
>>>>>>>>>> 
>>>>>>>>>> Yes.
>>>>>>>>> 
>>>>>>>>> += also works for this.
>>>>>>>> 
>>>>>>>> Hmm.  Easiest for the compiler might be an operator(op:String,
>>>>>>>> data:*)
>>>>>>>> method.  Let’s table this stuff for now.  I might have a better
>>>>>>>> idea
>>>>>>>> once
>>>>>>>> I’m actually doing the other compiler work.
>>>>>>>> 
>>>>>>>> -Alex
>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Alex Harui <ah...@adobe.com>.
If possible, try to break up things into "beads" that are replaceable, so
folks can swap in different behaviors if needed.  A flag ends up bringing
in code for all behaviors, "just in case".

-Alex

On 12/30/15, 3:45 PM, "Harbs" <ha...@gmail.com> wrote:

>DOMParser allows for more graceful handling of XML parsing errors than
>we’re used to in Flash (or classic E4X).
>
>I’m not sure the best way to handle this on the JS side. I see three ways
>to handle errors:
>
>1. I could just do what the Flash runtime does and just throw an error if
>there’s any kind of parsing error (like unclosed tags and the like).
>2. I could swallow errors that are thrown when a valid document is
>produced.
>3. I could return the XML object, but record the errors in the object.
>
>I guess there could be a flag on these behaviors if that makes sense.
>
>Thoughts?
>
>On Dec 30, 2015, at 8:02 PM, Alex Harui <ah...@adobe.com> wrote:
>
>> 
>> 
>> On 12/30/15, 9:16 AM, "Harbs" <ha...@gmail.com> wrote:
>> 
>>> And I’m assuming the signature will be something like this:
>>> setChild(nameOrQualifiedName:String,xmlOrXmlList:Object)
>> 
>> AS: myXML.someChild = someXMLorXMLList;
>> 
>> JS: myXML.setChild('someChild', someXMLorXMLList);
>> 
>> No idea of that actually is the case or not, I'm just looking at the
>> compiler source ;-).  And we can change it if you want.
>> 
>> -Alex
>> 
>>> 
>>> On Dec 30, 2015, at 6:13 PM, Harbs <ha...@gmail.com> wrote:
>>> 
>>>> OK. I think we discussed this, but it’s been a few weeks… ;-)
>>>> 
>>>> The method will accept either an XML or XMLList object.
>>>> 
>>>> On Dec 30, 2015, at 5:20 PM, Alex Harui <ah...@adobe.com> wrote:
>>>> 
>>>>> For assignment, there will be a call to setChild().
>>>>> 
>>>>> On 12/30/15, 3:09 AM, "Harbs" <ha...@gmail.com> wrote:
>>>>> 
>>>>>> The past month or so, I’ve been side-tracked with lots of things,
>>>>>>but
>>>>>> I’m
>>>>>> finally back on this.
>>>>>> 
>>>>>> I’m not sure what we decided in terms of assignment. AFAIK, there’s
>>>>>>no
>>>>>> assignment method in XML for replacing XML with a specific name with
>>>>>> an
>>>>>> XMLList. The closest we have is replace() which takes an XML object
>>>>>> and
>>>>>> not an XMLLIst. I’m not even sure what it does. (I guess I can try
>>>>>>it
>>>>>> and
>>>>>> see.)
>>>>>> 
>>>>>> Harbs
>>>>>> 
>>>>>> On Nov 19, 2015, at 9:06 AM, Alex Harui <ah...@adobe.com> wrote:
>>>>>> 
>>>>>>> OK, I've pushed changes that handle basic for loops and setting
>>>>>>> properties.  And even += on XMLLists.
>>>>>>> 
>>>>>>> You can get a sense of what works by looking at the unit tests in
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>>compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/f
>>>>>>>le
>>>>>>> xjs
>>>>>>> /T
>>>>>>> estFlexJSGlobalClasses.java
>>>>>>> 
>>>>>>> 
>>>>>>> I'm sure there are lots of cases I haven't thought of, but it will
>>>>>>> hopefully get you started.
>>>>>>> 
>>>>>>> -Alex
>>>>>>> 
>>>>>>> On 11/18/15, 3:12 PM, "Alex Harui" <ah...@adobe.com> wrote:
>>>>>>> 
>>>>>>>> I pushed changes to not use _as3_ on XML function calls and use
>>>>>>>> child()
>>>>>>>> for "." access.
>>>>>>>> 
>>>>>>>> I'm going to look into:
>>>>>>>> -for and foreach
>>>>>>>> -setting properties on XML/XMLList
>>>>>>>> 
>>>>>>>> -Alex
>>>>>>>> 
>>>>>>>> On 11/16/15, 11:47 AM, "Alex Harui" <ah...@adobe.com> wrote:
>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> On 11/16/15, 11:43 AM, "Harbs" <ha...@gmail.com> wrote:
>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> On Nov 16, 2015, at 9:40 PM, Harbs <ha...@gmail.com>
>>>>>>>>>>wrote:
>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> On Nov 16, 2015, at 9:14 PM, Alex Harui <ah...@adobe.com>
>>>>>>>>>>>wrote:
>>>>>>>>>>> 
>>>>>>>>>>>> Hmm.  I wonder what other operators work.  Like “-=“.
>>>>>>>>>>> 
>>>>>>>>>>> It looks like -= does not work.
>>>>>>>>>>> 
>>>>>>>>>>>> And does xmlList1 + xmlList2 concatenate them?
>>>>>>>>>>> 
>>>>>>>>>>> Yes.
>>>>>>>>>> 
>>>>>>>>>> += also works for this.
>>>>>>>>> 
>>>>>>>>> Hmm.  Easiest for the compiler might be an operator(op:String,
>>>>>>>>> data:*)
>>>>>>>>> method.  Let’s table this stuff for now.  I might have a better
>>>>>>>>> idea
>>>>>>>>> once
>>>>>>>>> I’m actually doing the other compiler work.
>>>>>>>>> 
>>>>>>>>> -Alex
>>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
DOMParser allows for more graceful handling of XML parsing errors than we’re used to in Flash (or classic E4X).

I’m not sure the best way to handle this on the JS side. I see three ways to handle errors:

1. I could just do what the Flash runtime does and just throw an error if there’s any kind of parsing error (like unclosed tags and the like).
2. I could swallow errors that are thrown when a valid document is produced.
3. I could return the XML object, but record the errors in the object.

I guess there could be a flag on these behaviors if that makes sense.

Thoughts?

On Dec 30, 2015, at 8:02 PM, Alex Harui <ah...@adobe.com> wrote:

> 
> 
> On 12/30/15, 9:16 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> And I’m assuming the signature will be something like this:
>> setChild(nameOrQualifiedName:String,xmlOrXmlList:Object)
> 
> AS: myXML.someChild = someXMLorXMLList;
> 
> JS: myXML.setChild('someChild', someXMLorXMLList);
> 
> No idea of that actually is the case or not, I'm just looking at the
> compiler source ;-).  And we can change it if you want.
> 
> -Alex
> 
>> 
>> On Dec 30, 2015, at 6:13 PM, Harbs <ha...@gmail.com> wrote:
>> 
>>> OK. I think we discussed this, but it’s been a few weeks… ;-)
>>> 
>>> The method will accept either an XML or XMLList object.
>>> 
>>> On Dec 30, 2015, at 5:20 PM, Alex Harui <ah...@adobe.com> wrote:
>>> 
>>>> For assignment, there will be a call to setChild().
>>>> 
>>>> On 12/30/15, 3:09 AM, "Harbs" <ha...@gmail.com> wrote:
>>>> 
>>>>> The past month or so, I’ve been side-tracked with lots of things, but
>>>>> I’m
>>>>> finally back on this.
>>>>> 
>>>>> I’m not sure what we decided in terms of assignment. AFAIK, there’s no
>>>>> assignment method in XML for replacing XML with a specific name with
>>>>> an
>>>>> XMLList. The closest we have is replace() which takes an XML object
>>>>> and
>>>>> not an XMLLIst. I’m not even sure what it does. (I guess I can try it
>>>>> and
>>>>> see.)
>>>>> 
>>>>> Harbs
>>>>> 
>>>>> On Nov 19, 2015, at 9:06 AM, Alex Harui <ah...@adobe.com> wrote:
>>>>> 
>>>>>> OK, I've pushed changes that handle basic for loops and setting
>>>>>> properties.  And even += on XMLLists.
>>>>>> 
>>>>>> You can get a sense of what works by looking at the unit tests in
>>>>>> 
>>>>>> 
>>>>>> compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/fle
>>>>>> xjs
>>>>>> /T
>>>>>> estFlexJSGlobalClasses.java
>>>>>> 
>>>>>> 
>>>>>> I'm sure there are lots of cases I haven't thought of, but it will
>>>>>> hopefully get you started.
>>>>>> 
>>>>>> -Alex
>>>>>> 
>>>>>> On 11/18/15, 3:12 PM, "Alex Harui" <ah...@adobe.com> wrote:
>>>>>> 
>>>>>>> I pushed changes to not use _as3_ on XML function calls and use
>>>>>>> child()
>>>>>>> for "." access.
>>>>>>> 
>>>>>>> I'm going to look into:
>>>>>>> -for and foreach
>>>>>>> -setting properties on XML/XMLList
>>>>>>> 
>>>>>>> -Alex
>>>>>>> 
>>>>>>> On 11/16/15, 11:47 AM, "Alex Harui" <ah...@adobe.com> wrote:
>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> On 11/16/15, 11:43 AM, "Harbs" <ha...@gmail.com> wrote:
>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> On Nov 16, 2015, at 9:40 PM, Harbs <ha...@gmail.com> wrote:
>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> On Nov 16, 2015, at 9:14 PM, Alex Harui <ah...@adobe.com> wrote:
>>>>>>>>>> 
>>>>>>>>>>> Hmm.  I wonder what other operators work.  Like “-=“.
>>>>>>>>>> 
>>>>>>>>>> It looks like -= does not work.
>>>>>>>>>> 
>>>>>>>>>>> And does xmlList1 + xmlList2 concatenate them?
>>>>>>>>>> 
>>>>>>>>>> Yes.
>>>>>>>>> 
>>>>>>>>> += also works for this.
>>>>>>>> 
>>>>>>>> Hmm.  Easiest for the compiler might be an operator(op:String,
>>>>>>>> data:*)
>>>>>>>> method.  Let’s table this stuff for now.  I might have a better
>>>>>>>> idea
>>>>>>>> once
>>>>>>>> I’m actually doing the other compiler work.
>>>>>>>> 
>>>>>>>> -Alex
>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 12/30/15, 9:16 AM, "Harbs" <ha...@gmail.com> wrote:

>And I’m assuming the signature will be something like this:
>setChild(nameOrQualifiedName:String,xmlOrXmlList:Object)

AS: myXML.someChild = someXMLorXMLList;

JS: myXML.setChild('someChild', someXMLorXMLList);

No idea of that actually is the case or not, I'm just looking at the
compiler source ;-).  And we can change it if you want.

-Alex

>
>On Dec 30, 2015, at 6:13 PM, Harbs <ha...@gmail.com> wrote:
>
>> OK. I think we discussed this, but it’s been a few weeks… ;-)
>> 
>> The method will accept either an XML or XMLList object.
>> 
>> On Dec 30, 2015, at 5:20 PM, Alex Harui <ah...@adobe.com> wrote:
>> 
>>> For assignment, there will be a call to setChild().
>>> 
>>> On 12/30/15, 3:09 AM, "Harbs" <ha...@gmail.com> wrote:
>>> 
>>>> The past month or so, I’ve been side-tracked with lots of things, but
>>>>I’m
>>>> finally back on this.
>>>> 
>>>> I’m not sure what we decided in terms of assignment. AFAIK, there’s no
>>>> assignment method in XML for replacing XML with a specific name with
>>>>an
>>>> XMLList. The closest we have is replace() which takes an XML object
>>>>and
>>>> not an XMLLIst. I’m not even sure what it does. (I guess I can try it
>>>>and
>>>> see.)
>>>> 
>>>> Harbs
>>>> 
>>>> On Nov 19, 2015, at 9:06 AM, Alex Harui <ah...@adobe.com> wrote:
>>>> 
>>>>> OK, I've pushed changes that handle basic for loops and setting
>>>>> properties.  And even += on XMLLists.
>>>>> 
>>>>> You can get a sense of what works by looking at the unit tests in
>>>>> 
>>>>> 
>>>>>compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/fle
>>>>>xjs
>>>>> /T
>>>>> estFlexJSGlobalClasses.java
>>>>> 
>>>>> 
>>>>> I'm sure there are lots of cases I haven't thought of, but it will
>>>>> hopefully get you started.
>>>>> 
>>>>> -Alex
>>>>> 
>>>>> On 11/18/15, 3:12 PM, "Alex Harui" <ah...@adobe.com> wrote:
>>>>> 
>>>>>> I pushed changes to not use _as3_ on XML function calls and use
>>>>>>child()
>>>>>> for "." access.
>>>>>> 
>>>>>> I'm going to look into:
>>>>>> -for and foreach
>>>>>> -setting properties on XML/XMLList
>>>>>> 
>>>>>> -Alex
>>>>>> 
>>>>>> On 11/16/15, 11:47 AM, "Alex Harui" <ah...@adobe.com> wrote:
>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> On 11/16/15, 11:43 AM, "Harbs" <ha...@gmail.com> wrote:
>>>>>>> 
>>>>>>>> 
>>>>>>>> On Nov 16, 2015, at 9:40 PM, Harbs <ha...@gmail.com> wrote:
>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> On Nov 16, 2015, at 9:14 PM, Alex Harui <ah...@adobe.com> wrote:
>>>>>>>>> 
>>>>>>>>>> Hmm.  I wonder what other operators work.  Like “-=“.
>>>>>>>>> 
>>>>>>>>> It looks like -= does not work.
>>>>>>>>> 
>>>>>>>>>> And does xmlList1 + xmlList2 concatenate them?
>>>>>>>>> 
>>>>>>>>> Yes.
>>>>>>>> 
>>>>>>>> += also works for this.
>>>>>>> 
>>>>>>> Hmm.  Easiest for the compiler might be an operator(op:String,
>>>>>>>data:*)
>>>>>>> method.  Let’s table this stuff for now.  I might have a better
>>>>>>>idea
>>>>>>> once
>>>>>>> I’m actually doing the other compiler work.
>>>>>>> 
>>>>>>> -Alex
>>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
And I’m assuming the signature will be something like this: setChild(nameOrQualifiedName:String,xmlOrXmlList:Object)

On Dec 30, 2015, at 6:13 PM, Harbs <ha...@gmail.com> wrote:

> OK. I think we discussed this, but it’s been a few weeks… ;-)
> 
> The method will accept either an XML or XMLList object.
> 
> On Dec 30, 2015, at 5:20 PM, Alex Harui <ah...@adobe.com> wrote:
> 
>> For assignment, there will be a call to setChild().
>> 
>> On 12/30/15, 3:09 AM, "Harbs" <ha...@gmail.com> wrote:
>> 
>>> The past month or so, I’ve been side-tracked with lots of things, but I’m
>>> finally back on this.
>>> 
>>> I’m not sure what we decided in terms of assignment. AFAIK, there’s no
>>> assignment method in XML for replacing XML with a specific name with an
>>> XMLList. The closest we have is replace() which takes an XML object and
>>> not an XMLLIst. I’m not even sure what it does. (I guess I can try it and
>>> see.)
>>> 
>>> Harbs
>>> 
>>> On Nov 19, 2015, at 9:06 AM, Alex Harui <ah...@adobe.com> wrote:
>>> 
>>>> OK, I've pushed changes that handle basic for loops and setting
>>>> properties.  And even += on XMLLists.
>>>> 
>>>> You can get a sense of what works by looking at the unit tests in
>>>> 
>>>> compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs
>>>> /T
>>>> estFlexJSGlobalClasses.java
>>>> 
>>>> 
>>>> I'm sure there are lots of cases I haven't thought of, but it will
>>>> hopefully get you started.
>>>> 
>>>> -Alex
>>>> 
>>>> On 11/18/15, 3:12 PM, "Alex Harui" <ah...@adobe.com> wrote:
>>>> 
>>>>> I pushed changes to not use _as3_ on XML function calls and use child()
>>>>> for "." access.
>>>>> 
>>>>> I'm going to look into:
>>>>> -for and foreach
>>>>> -setting properties on XML/XMLList
>>>>> 
>>>>> -Alex
>>>>> 
>>>>> On 11/16/15, 11:47 AM, "Alex Harui" <ah...@adobe.com> wrote:
>>>>> 
>>>>>> 
>>>>>> 
>>>>>> On 11/16/15, 11:43 AM, "Harbs" <ha...@gmail.com> wrote:
>>>>>> 
>>>>>>> 
>>>>>>> On Nov 16, 2015, at 9:40 PM, Harbs <ha...@gmail.com> wrote:
>>>>>>> 
>>>>>>>> 
>>>>>>>> On Nov 16, 2015, at 9:14 PM, Alex Harui <ah...@adobe.com> wrote:
>>>>>>>> 
>>>>>>>>> Hmm.  I wonder what other operators work.  Like “-=“.
>>>>>>>> 
>>>>>>>> It looks like -= does not work.
>>>>>>>> 
>>>>>>>>> And does xmlList1 + xmlList2 concatenate them?
>>>>>>>> 
>>>>>>>> Yes.
>>>>>>> 
>>>>>>> += also works for this.
>>>>>> 
>>>>>> Hmm.  Easiest for the compiler might be an operator(op:String, data:*)
>>>>>> method.  Let’s table this stuff for now.  I might have a better idea
>>>>>> once
>>>>>> I’m actually doing the other compiler work.
>>>>>> 
>>>>>> -Alex
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
OK. I think we discussed this, but it’s been a few weeks… ;-)

The method will accept either an XML or XMLList object.

On Dec 30, 2015, at 5:20 PM, Alex Harui <ah...@adobe.com> wrote:

> For assignment, there will be a call to setChild().
> 
> On 12/30/15, 3:09 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> The past month or so, I’ve been side-tracked with lots of things, but I’m
>> finally back on this.
>> 
>> I’m not sure what we decided in terms of assignment. AFAIK, there’s no
>> assignment method in XML for replacing XML with a specific name with an
>> XMLList. The closest we have is replace() which takes an XML object and
>> not an XMLLIst. I’m not even sure what it does. (I guess I can try it and
>> see.)
>> 
>> Harbs
>> 
>> On Nov 19, 2015, at 9:06 AM, Alex Harui <ah...@adobe.com> wrote:
>> 
>>> OK, I've pushed changes that handle basic for loops and setting
>>> properties.  And even += on XMLLists.
>>> 
>>> You can get a sense of what works by looking at the unit tests in
>>> 
>>> compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs
>>> /T
>>> estFlexJSGlobalClasses.java
>>> 
>>> 
>>> I'm sure there are lots of cases I haven't thought of, but it will
>>> hopefully get you started.
>>> 
>>> -Alex
>>> 
>>> On 11/18/15, 3:12 PM, "Alex Harui" <ah...@adobe.com> wrote:
>>> 
>>>> I pushed changes to not use _as3_ on XML function calls and use child()
>>>> for "." access.
>>>> 
>>>> I'm going to look into:
>>>> -for and foreach
>>>> -setting properties on XML/XMLList
>>>> 
>>>> -Alex
>>>> 
>>>> On 11/16/15, 11:47 AM, "Alex Harui" <ah...@adobe.com> wrote:
>>>> 
>>>>> 
>>>>> 
>>>>> On 11/16/15, 11:43 AM, "Harbs" <ha...@gmail.com> wrote:
>>>>> 
>>>>>> 
>>>>>> On Nov 16, 2015, at 9:40 PM, Harbs <ha...@gmail.com> wrote:
>>>>>> 
>>>>>>> 
>>>>>>> On Nov 16, 2015, at 9:14 PM, Alex Harui <ah...@adobe.com> wrote:
>>>>>>> 
>>>>>>>> Hmm.  I wonder what other operators work.  Like “-=“.
>>>>>>> 
>>>>>>> It looks like -= does not work.
>>>>>>> 
>>>>>>>> And does xmlList1 + xmlList2 concatenate them?
>>>>>>> 
>>>>>>> Yes.
>>>>>> 
>>>>>> += also works for this.
>>>>> 
>>>>> Hmm.  Easiest for the compiler might be an operator(op:String, data:*)
>>>>> method.  Let’s table this stuff for now.  I might have a better idea
>>>>> once
>>>>> I’m actually doing the other compiler work.
>>>>> 
>>>>> -Alex
>>>>> 
>>>> 
>>> 
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Alex Harui <ah...@adobe.com>.
For assignment, there will be a call to setChild().

On 12/30/15, 3:09 AM, "Harbs" <ha...@gmail.com> wrote:

>The past month or so, I’ve been side-tracked with lots of things, but I’m
>finally back on this.
>
>I’m not sure what we decided in terms of assignment. AFAIK, there’s no
>assignment method in XML for replacing XML with a specific name with an
>XMLList. The closest we have is replace() which takes an XML object and
>not an XMLLIst. I’m not even sure what it does. (I guess I can try it and
>see.)
>
>Harbs
>
>On Nov 19, 2015, at 9:06 AM, Alex Harui <ah...@adobe.com> wrote:
>
>> OK, I've pushed changes that handle basic for loops and setting
>> properties.  And even += on XMLLists.
>> 
>> You can get a sense of what works by looking at the unit tests in
>> 
>>compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs
>>/T
>> estFlexJSGlobalClasses.java
>> 
>> 
>> I'm sure there are lots of cases I haven't thought of, but it will
>> hopefully get you started.
>> 
>> -Alex
>> 
>> On 11/18/15, 3:12 PM, "Alex Harui" <ah...@adobe.com> wrote:
>> 
>>> I pushed changes to not use _as3_ on XML function calls and use child()
>>> for "." access.
>>> 
>>> I'm going to look into:
>>> -for and foreach
>>> -setting properties on XML/XMLList
>>> 
>>> -Alex
>>> 
>>> On 11/16/15, 11:47 AM, "Alex Harui" <ah...@adobe.com> wrote:
>>> 
>>>> 
>>>> 
>>>> On 11/16/15, 11:43 AM, "Harbs" <ha...@gmail.com> wrote:
>>>> 
>>>>> 
>>>>> On Nov 16, 2015, at 9:40 PM, Harbs <ha...@gmail.com> wrote:
>>>>> 
>>>>>> 
>>>>>> On Nov 16, 2015, at 9:14 PM, Alex Harui <ah...@adobe.com> wrote:
>>>>>> 
>>>>>>> Hmm.  I wonder what other operators work.  Like “-=“.
>>>>>> 
>>>>>> It looks like -= does not work.
>>>>>> 
>>>>>>> And does xmlList1 + xmlList2 concatenate them?
>>>>>> 
>>>>>> Yes.
>>>>> 
>>>>> += also works for this.
>>>> 
>>>> Hmm.  Easiest for the compiler might be an operator(op:String, data:*)
>>>> method.  Let’s table this stuff for now.  I might have a better idea
>>>>once
>>>> I’m actually doing the other compiler work.
>>>> 
>>>> -Alex
>>>> 
>>> 
>> 
>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
The past month or so, I’ve been side-tracked with lots of things, but I’m finally back on this.

I’m not sure what we decided in terms of assignment. AFAIK, there’s no assignment method in XML for replacing XML with a specific name with an XMLList. The closest we have is replace() which takes an XML object and not an XMLLIst. I’m not even sure what it does. (I guess I can try it and see.)

Harbs

On Nov 19, 2015, at 9:06 AM, Alex Harui <ah...@adobe.com> wrote:

> OK, I've pushed changes that handle basic for loops and setting
> properties.  And even += on XMLLists.
> 
> You can get a sense of what works by looking at the unit tests in
> compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/T
> estFlexJSGlobalClasses.java
> 
> 
> I'm sure there are lots of cases I haven't thought of, but it will
> hopefully get you started.
> 
> -Alex
> 
> On 11/18/15, 3:12 PM, "Alex Harui" <ah...@adobe.com> wrote:
> 
>> I pushed changes to not use _as3_ on XML function calls and use child()
>> for "." access.
>> 
>> I'm going to look into:
>> -for and foreach
>> -setting properties on XML/XMLList
>> 
>> -Alex
>> 
>> On 11/16/15, 11:47 AM, "Alex Harui" <ah...@adobe.com> wrote:
>> 
>>> 
>>> 
>>> On 11/16/15, 11:43 AM, "Harbs" <ha...@gmail.com> wrote:
>>> 
>>>> 
>>>> On Nov 16, 2015, at 9:40 PM, Harbs <ha...@gmail.com> wrote:
>>>> 
>>>>> 
>>>>> On Nov 16, 2015, at 9:14 PM, Alex Harui <ah...@adobe.com> wrote:
>>>>> 
>>>>>> Hmm.  I wonder what other operators work.  Like “-=“.
>>>>> 
>>>>> It looks like -= does not work.
>>>>> 
>>>>>> And does xmlList1 + xmlList2 concatenate them?
>>>>> 
>>>>> Yes.
>>>> 
>>>> += also works for this.
>>> 
>>> Hmm.  Easiest for the compiler might be an operator(op:String, data:*)
>>> method.  Let’s table this stuff for now.  I might have a better idea once
>>> I’m actually doing the other compiler work.
>>> 
>>> -Alex
>>> 
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Alex Harui <ah...@adobe.com>.
OK, I've pushed changes that handle basic for loops and setting
properties.  And even += on XMLLists.

You can get a sense of what works by looking at the unit tests in
compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/T
estFlexJSGlobalClasses.java


I'm sure there are lots of cases I haven't thought of, but it will
hopefully get you started.

-Alex

On 11/18/15, 3:12 PM, "Alex Harui" <ah...@adobe.com> wrote:

>I pushed changes to not use _as3_ on XML function calls and use child()
>for "." access.
>
>I'm going to look into:
>-for and foreach
>-setting properties on XML/XMLList
>
>-Alex
>
>On 11/16/15, 11:47 AM, "Alex Harui" <ah...@adobe.com> wrote:
>
>>
>>
>>On 11/16/15, 11:43 AM, "Harbs" <ha...@gmail.com> wrote:
>>
>>>
>>>On Nov 16, 2015, at 9:40 PM, Harbs <ha...@gmail.com> wrote:
>>>
>>>> 
>>>> On Nov 16, 2015, at 9:14 PM, Alex Harui <ah...@adobe.com> wrote:
>>>> 
>>>>> Hmm.  I wonder what other operators work.  Like “-=“.
>>>> 
>>>> It looks like -= does not work.
>>>> 
>>>>> And does xmlList1 + xmlList2 concatenate them?
>>>> 
>>>> Yes.
>>>
>>>+= also works for this.
>>
>>Hmm.  Easiest for the compiler might be an operator(op:String, data:*)
>>method.  Let’s table this stuff for now.  I might have a better idea once
>>I’m actually doing the other compiler work.
>>
>>-Alex
>>
>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Alex Harui <ah...@adobe.com>.
I pushed changes to not use _as3_ on XML function calls and use child()
for "." access.

I'm going to look into:
-for and foreach
-setting properties on XML/XMLList

-Alex

On 11/16/15, 11:47 AM, "Alex Harui" <ah...@adobe.com> wrote:

>
>
>On 11/16/15, 11:43 AM, "Harbs" <ha...@gmail.com> wrote:
>
>>
>>On Nov 16, 2015, at 9:40 PM, Harbs <ha...@gmail.com> wrote:
>>
>>> 
>>> On Nov 16, 2015, at 9:14 PM, Alex Harui <ah...@adobe.com> wrote:
>>> 
>>>> Hmm.  I wonder what other operators work.  Like “-=“.
>>> 
>>> It looks like -= does not work.
>>> 
>>>> And does xmlList1 + xmlList2 concatenate them?
>>> 
>>> Yes.
>>
>>+= also works for this.
>
>Hmm.  Easiest for the compiler might be an operator(op:String, data:*)
>method.  Let’s table this stuff for now.  I might have a better idea once
>I’m actually doing the other compiler work.
>
>-Alex
>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 11/16/15, 11:43 AM, "Harbs" <ha...@gmail.com> wrote:

>
>On Nov 16, 2015, at 9:40 PM, Harbs <ha...@gmail.com> wrote:
>
>> 
>> On Nov 16, 2015, at 9:14 PM, Alex Harui <ah...@adobe.com> wrote:
>> 
>>> Hmm.  I wonder what other operators work.  Like “-=“.
>> 
>> It looks like -= does not work.
>> 
>>> And does xmlList1 + xmlList2 concatenate them?
>> 
>> Yes.
>
>+= also works for this.

Hmm.  Easiest for the compiler might be an operator(op:String, data:*)
method.  Let’s table this stuff for now.  I might have a better idea once
I’m actually doing the other compiler work.

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
On Nov 16, 2015, at 9:40 PM, Harbs <ha...@gmail.com> wrote:

> 
> On Nov 16, 2015, at 9:14 PM, Alex Harui <ah...@adobe.com> wrote:
> 
>> Hmm.  I wonder what other operators work.  Like “-=“.
> 
> It looks like -= does not work.
> 
>> And does xmlList1 + xmlList2 concatenate them?
> 
> Yes.

+= also works for this.


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
On Nov 16, 2015, at 9:14 PM, Alex Harui <ah...@adobe.com> wrote:

> Hmm.  I wonder what other operators work.  Like “-=“.

It looks like -= does not work.

> And does xmlList1 + xmlList2 concatenate them?

Yes.

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Creating a new setChild method should be fine. How would we differentiate between + and +=? Two new methods? Or something else?


On Nov 16, 2015, at 9:14 PM, Alex Harui <ah...@adobe.com> wrote:

> 
> 
> On 11/16/15, 10:54 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> 
>> On Nov 16, 2015, at 8:03 PM, Alex Harui <ah...@adobe.com> wrote:
>> 
>>> 
>>> 
>>> On 11/16/15, 9:54 AM, "Harbs" <ha...@gmail.com> wrote:
>>> 
>>>>> 2) detect read and write on XML/XMLList and convert read to child().
>>>>> What
>>>>> about write()?
>>>> 
>>>> Good question. I think we should map xml.foo = <foo id=“1"/> to
>>>> xml.replace(“foo”,new XML(“<foo id=\”1\”/>”));
>>> 
>>> What does the above actually do if there is only one foo child and if
>>> there are more than one foo.child?
>> 
>> 1. xml.foo = someXML replaces all foos with someXML (in the location of
>> the first foo)
>> 2. xml.foo = someXMLList removes all foos and adds in the ones from the
>> list (in the location of the first foo)
>> 
>>> Do you know if you can use += to append?
>> 
>> How do you like that? I’ve never thought of trying +=! I just tried and
>> it works like a charm! It adds it in after the last foo or at the end if
>> foo does not exist.
> 
> Hmm.  I wonder what other operators work.  Like “-=“.  And does xmlList1 +
> xmlList2 concatenate them?
> 
>> 
>> I’m not sure what the best mapping for this will be. We probably should
>> get a reference to the last foo and map it to
>> xml.insertChildAfter(lastFoo,newFoo) if there are any foos. Otherwise it
>> should map to appendChild().
> 
> OK.  Thanks for doing the testing.
> 
> The compiler cannot know whether there will be a foo at compile-time, so
> for all of these cases, I think we’ll have to call a new setChild() method
> and your code will have to “do the right things”.
> 
> Replacing “=“ expressions with method calls is quite painful in the
> compiler and the output can look very messy.  What do you think about
> implementing setChild as a setter instead of a method?
> 
> -Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 11/16/15, 10:54 AM, "Harbs" <ha...@gmail.com> wrote:

>
>On Nov 16, 2015, at 8:03 PM, Alex Harui <ah...@adobe.com> wrote:
>
>> 
>> 
>> On 11/16/15, 9:54 AM, "Harbs" <ha...@gmail.com> wrote:
>> 
>>>> 2) detect read and write on XML/XMLList and convert read to child().
>>>> What
>>>> about write()?
>>> 
>>> Good question. I think we should map xml.foo = <foo id=“1"/> to
>>> xml.replace(“foo”,new XML(“<foo id=\”1\”/>”));
>> 
>> What does the above actually do if there is only one foo child and if
>> there are more than one foo.child?
>
>1. xml.foo = someXML replaces all foos with someXML (in the location of
>the first foo)
>2. xml.foo = someXMLList removes all foos and adds in the ones from the
>list (in the location of the first foo)
>
>> Do you know if you can use += to append?
>
>How do you like that? I’ve never thought of trying +=! I just tried and
>it works like a charm! It adds it in after the last foo or at the end if
>foo does not exist.

Hmm.  I wonder what other operators work.  Like “-=“.  And does xmlList1 +
xmlList2 concatenate them?

>
>I’m not sure what the best mapping for this will be. We probably should
>get a reference to the last foo and map it to
>xml.insertChildAfter(lastFoo,newFoo) if there are any foos. Otherwise it
>should map to appendChild().

OK.  Thanks for doing the testing.

The compiler cannot know whether there will be a foo at compile-time, so
for all of these cases, I think we’ll have to call a new setChild() method
and your code will have to “do the right things”.

Replacing “=“ expressions with method calls is quite painful in the
compiler and the output can look very messy.  What do you think about
implementing setChild as a setter instead of a method?

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
On Nov 16, 2015, at 8:03 PM, Alex Harui <ah...@adobe.com> wrote:

> 
> 
> On 11/16/15, 9:54 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>>> 2) detect read and write on XML/XMLList and convert read to child().
>>> What
>>> about write()?
>> 
>> Good question. I think we should map xml.foo = <foo id=“1"/> to
>> xml.replace(“foo”,new XML(“<foo id=\”1\”/>”));
> 
> What does the above actually do if there is only one foo child and if
> there are more than one foo.child?

1. xml.foo = someXML replaces all foos with someXML (in the location of the first foo)
2. xml.foo = someXMLList removes all foos and adds in the ones from the list (in the location of the first foo)

> Do you know if you can use += to append?

How do you like that? I’ve never thought of trying +=! I just tried and it works like a charm! It adds it in after the last foo or at the end if foo does not exist.

I’m not sure what the best mapping for this will be. We probably should get a reference to the last foo and map it to xml.insertChildAfter(lastFoo,newFoo) if there are any foos. Otherwise it should map to appendChild().

> 
> -Alex
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 11/16/15, 9:54 AM, "Harbs" <ha...@gmail.com> wrote:

>>2) detect read and write on XML/XMLList and convert read to child().
>>What
>> about write()?
>
>Good question. I think we should map xml.foo = <foo id=“1"/> to
>xml.replace(“foo”,new XML(“<foo id=\”1\”/>”));

What does the above actually do if there is only one foo child and if
there are more than one foo.child?  Do you know if you can use += to
append?

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
On Nov 16, 2015, at 6:06 PM, Alex Harui <ah...@adobe.com> wrote:

> 
> 
> On 11/16/15, 12:51 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> This seems like a partial solution. The thing with dot notation, is that
>> you can use anything — even elements that do not exist. You have a
>> mismatch between your xml and your code. In your example, xml.committer
>> will return an XMLList with two elements. xml.employee will return an
>> XMLList with a length() of 0. Unless we map the dot notation to child()
>> in the compiler, we will get a LOT of errors in existing E4X code.
>> Checking xml.element.length() is a very common way of checking that an
>> element exists.
> 
> Ah, ok. Didn’t know that.
> 
>> 
>> I guess we could use defineProperty for the cases when the Type of the
>> XML is not clear to the compiler, but even then, it will only work if the
>> client code is only checking elements which exist. It seems to me that
>> consistently failing on non-typed XML is easier to deal with then
>> sometimes-yes- sometimes-no access. But I could imagine others disagree.
> 
> One compiler feature I’ve wanted to try to implement I’ve referred to in
> the past as ‘frickin-strict’ or ‘super-strict’, although I think a better
> name would be warn-on-Object-access.  And it would basically emit a
> warning wherever your code read or wrote to something of type Object (and
> *).  I don’t think we’ve done this anywhere else in the compiler, but in
> theory we could also enable/disable that checking per-file or per-method.
> I’ve been told if you were to turn on such a feature, almost everybody’s
> code would generate 100’s of such warning.
> 
> So I think the summary of compiler changes is:
> 1) no more _as3_ prefixes on the function calls on XML/XMLList
> 2) detect read and write on XML/XMLList and convert read to child().  What
> about write()?

Good question. I think we should map xml.foo = <foo id=“1"/> to xml.replace(“foo”,new XML(“<foo id=\”1\”/>”));

> 3) detect for..in and foreach..in on XML/XMLList.  There is no foreach in
> JS, so foreach is converted into for..in with some glue code so the body
> of the loop executes correctly.  I think all we need is an
> elementNames():Array method that returns the array of element names.

OK. I can add a method like that.

> 4) detect read and write on plain Object and add warning.

Optionally. You’re probably right about something like this causing lots of warnings. I’m not sure if you’re thinking of some way to limit these warnings to places where it’s likely XML objects.

> Thoughts?
> -Alex
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 11/16/15, 12:51 AM, "Harbs" <ha...@gmail.com> wrote:

>This seems like a partial solution. The thing with dot notation, is that
>you can use anything — even elements that do not exist. You have a
>mismatch between your xml and your code. In your example, xml.committer
>will return an XMLList with two elements. xml.employee will return an
>XMLList with a length() of 0. Unless we map the dot notation to child()
>in the compiler, we will get a LOT of errors in existing E4X code.
>Checking xml.element.length() is a very common way of checking that an
>element exists.

Ah, ok. Didn’t know that.

>
>I guess we could use defineProperty for the cases when the Type of the
>XML is not clear to the compiler, but even then, it will only work if the
>client code is only checking elements which exist. It seems to me that
>consistently failing on non-typed XML is easier to deal with then
>sometimes-yes- sometimes-no access. But I could imagine others disagree.

One compiler feature I’ve wanted to try to implement I’ve referred to in
the past as ‘frickin-strict’ or ‘super-strict’, although I think a better
name would be warn-on-Object-access.  And it would basically emit a
warning wherever your code read or wrote to something of type Object (and
*).  I don’t think we’ve done this anywhere else in the compiler, but in
theory we could also enable/disable that checking per-file or per-method.
I’ve been told if you were to turn on such a feature, almost everybody’s
code would generate 100’s of such warning.

So I think the summary of compiler changes is:
1) no more _as3_ prefixes on the function calls on XML/XMLList
2) detect read and write on XML/XMLList and convert read to child().  What
about write()?
3) detect for..in and foreach..in on XML/XMLList.  There is no foreach in
JS, so foreach is converted into for..in with some glue code so the body
of the loop executes correctly.  I think all we need is an
elementNames():Array method that returns the array of element names.
4) detect read and write on plain Object and add warning.

Thoughts?
-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Of course, my suggestion of using event.target.myXML.child(“foo”) will only work if we do not prepend _as3_.

Actually, prepending will break any use of XML methods for non-typed XML.

On Nov 16, 2015, at 10:51 AM, Harbs <ha...@gmail.com> wrote:

> This seems like a partial solution. The thing with dot notation, is that you can use anything — even elements that do not exist. You have a mismatch between your xml and your code. In your example, xml.committer will return an XMLList with two elements. xml.employee will return an XMLList with a length() of 0. Unless we map the dot notation to child() in the compiler, we will get a LOT of errors in existing E4X code. Checking xml.element.length() is a very common way of checking that an element exists.
> 
> I guess we could use defineProperty for the cases when the Type of the XML is not clear to the compiler, but even then, it will only work if the client code is only checking elements which exist. It seems to me that consistently failing on non-typed XML is easier to deal with then sometimes-yes- sometimes-no access. But I could imagine others disagree.
> 
> FWIW, we can make the following recommendations:
> 
> 1. Use a local variable which has its type set for XML:
> var lis:XMLList = event.target.myXML;
> trace(list.foo);
> 2. Use type casting: trace((event.target.myXML as XMLList).foo); or trace(XMLList(event.target.myXML).foo);
> 3. When the type is not defined, use .child(): trace(event.target.myXML.child(“foo”));
> 
> On Nov 16, 2015, at 7:31 AM, Alex Harui <ah...@adobe.com> wrote:
> 
>> 
>> 
>> On 11/15/15, 7:55 AM, "Harbs" <ha...@gmail.com> wrote:
>> 
>>> Right, but I don’t see any way around this. Simple property access will
>>> not work for the reasons I wrote above.
>> 
>> My thinking was that, for some XML like:
>> 
>> <project>
>> <committer id=“1”>
>>   <firstname>Alex</firstname>
>>   <lastname>Harui</lastname>
>> </committer >
>> < committer id=“2”>
>>   <firstname>Peter</firstname>
>>    <lastname>Ent</lastname>
>> </committer >
>> <product id=“1”>
>>   <name>Flex</name>
>> </product>
>> <product id=“2”>
>>   <name>FlexJS</name>
>> </product>
>> </project>
>> 
>> that you would instantiate an XML instance, and defineProperties employee
>> and product with getters that call child(“employee”) and child(“product”)
>> respectively.
>> 
>> The XMLList returned from child(“employee”) would have defineProperties
>> for “1”, “2”, and also “firstname” and “lastname”.
>> The XMLList returned from child(“product”) would have defineProperties for
>> “1”, “2”, and also “name”, which is why I was thinking we would want the
>> name() function to be _as3_name().
>> 
>> Of course, I could be missing something.  I always figured that XML and
>> XMLList use something like flash_proxy underneath, where it could detect
>> any reads and writes from an instance.  There is no such thing in JS as
>> far as I know, so the best we can do is defineProperties that we know we
>> need so we can detect reads and writes on them.
>> 
>> 
>> -Alex
>> 
>> 
>>> 
>>> 
>>> On Nov 15, 2015, at 5:49 PM, Alex Harui <ah...@adobe.com> wrote:
>>> 
>>>> The compiler does not know that myXML is from myClass so it would simply
>>>> add a property access to foo.  Now we could require that folks more
>>>> strongly type their code by adding in
>>>> 
>>>> trace((event.target.myXML as XMLList).foo);
>>>> 
>>>> 
>>>> But we might get complaints.  The fact we normally don’t need all that
>>>> casting is what can make AS more efficient than languages that require
>>>> the
>>>> casting like Java and C++.
>>> 
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
This seems like a partial solution. The thing with dot notation, is that you can use anything — even elements that do not exist. You have a mismatch between your xml and your code. In your example, xml.committer will return an XMLList with two elements. xml.employee will return an XMLList with a length() of 0. Unless we map the dot notation to child() in the compiler, we will get a LOT of errors in existing E4X code. Checking xml.element.length() is a very common way of checking that an element exists.

I guess we could use defineProperty for the cases when the Type of the XML is not clear to the compiler, but even then, it will only work if the client code is only checking elements which exist. It seems to me that consistently failing on non-typed XML is easier to deal with then sometimes-yes- sometimes-no access. But I could imagine others disagree.

FWIW, we can make the following recommendations:

1. Use a local variable which has its type set for XML:
var lis:XMLList = event.target.myXML;
trace(list.foo);
2. Use type casting: trace((event.target.myXML as XMLList).foo); or trace(XMLList(event.target.myXML).foo);
3. When the type is not defined, use .child(): trace(event.target.myXML.child(“foo”));

On Nov 16, 2015, at 7:31 AM, Alex Harui <ah...@adobe.com> wrote:

> 
> 
> On 11/15/15, 7:55 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> Right, but I don’t see any way around this. Simple property access will
>> not work for the reasons I wrote above.
> 
> My thinking was that, for some XML like:
> 
> <project>
>  <committer id=“1”>
>    <firstname>Alex</firstname>
>    <lastname>Harui</lastname>
>  </committer >
>  < committer id=“2”>
>    <firstname>Peter</firstname>
>     <lastname>Ent</lastname>
>  </committer >
>  <product id=“1”>
>    <name>Flex</name>
>  </product>
>  <product id=“2”>
>    <name>FlexJS</name>
>  </product>
> </project>
> 
> that you would instantiate an XML instance, and defineProperties employee
> and product with getters that call child(“employee”) and child(“product”)
> respectively.
> 
> The XMLList returned from child(“employee”) would have defineProperties
> for “1”, “2”, and also “firstname” and “lastname”.
> The XMLList returned from child(“product”) would have defineProperties for
> “1”, “2”, and also “name”, which is why I was thinking we would want the
> name() function to be _as3_name().
> 
> Of course, I could be missing something.  I always figured that XML and
> XMLList use something like flash_proxy underneath, where it could detect
> any reads and writes from an instance.  There is no such thing in JS as
> far as I know, so the best we can do is defineProperties that we know we
> need so we can detect reads and writes on them.
> 
> 
> -Alex
> 
> 
>> 
>> 
>> On Nov 15, 2015, at 5:49 PM, Alex Harui <ah...@adobe.com> wrote:
>> 
>>> The compiler does not know that myXML is from myClass so it would simply
>>> add a property access to foo.  Now we could require that folks more
>>> strongly type their code by adding in
>>> 
>>> trace((event.target.myXML as XMLList).foo);
>>> 
>>> 
>>> But we might get complaints.  The fact we normally don’t need all that
>>> casting is what can make AS more efficient than languages that require
>>> the
>>> casting like Java and C++.
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 11/15/15, 7:55 AM, "Harbs" <ha...@gmail.com> wrote:

>Right, but I don’t see any way around this. Simple property access will
>not work for the reasons I wrote above.

My thinking was that, for some XML like:

<project>
  <committer id=“1”>
    <firstname>Alex</firstname>
    <lastname>Harui</lastname>
  </committer >
  < committer id=“2”>
    <firstname>Peter</firstname>
     <lastname>Ent</lastname>
  </committer >
  <product id=“1”>
    <name>Flex</name>
  </product>
  <product id=“2”>
    <name>FlexJS</name>
  </product>
</project>

that you would instantiate an XML instance, and defineProperties employee
and product with getters that call child(“employee”) and child(“product”)
respectively.

The XMLList returned from child(“employee”) would have defineProperties
for “1”, “2”, and also “firstname” and “lastname”.
The XMLList returned from child(“product”) would have defineProperties for
“1”, “2”, and also “name”, which is why I was thinking we would want the
name() function to be _as3_name().

Of course, I could be missing something.  I always figured that XML and
XMLList use something like flash_proxy underneath, where it could detect
any reads and writes from an instance.  There is no such thing in JS as
far as I know, so the best we can do is defineProperties that we know we
need so we can detect reads and writes on them.


-Alex


>
>
>On Nov 15, 2015, at 5:49 PM, Alex Harui <ah...@adobe.com> wrote:
>
>> The compiler does not know that myXML is from myClass so it would simply
>> add a property access to foo.  Now we could require that folks more
>> strongly type their code by adding in
>> 
>>  trace((event.target.myXML as XMLList).foo);
>> 
>> 
>> But we might get complaints.  The fact we normally don’t need all that
>> casting is what can make AS more efficient than languages that require
>>the
>> casting like Java and C++.
>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Right, but I don’t see any way around this. Simple property access will not work for the reasons I wrote above.


On Nov 15, 2015, at 5:49 PM, Alex Harui <ah...@adobe.com> wrote:

> The compiler does not know that myXML is from myClass so it would simply
> add a property access to foo.  Now we could require that folks more
> strongly type their code by adding in
> 
>  trace((event.target.myXML as XMLList).foo);
> 
> 
> But we might get complaints.  The fact we normally don’t need all that
> casting is what can make AS more efficient than languages that require the
> casting like Java and C++.


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 11/15/15, 7:02 AM, "Harbs" <ha...@gmail.com> wrote:
>>For #1, my thoughts were that you would not use Array as the base class
>> for XML and XMLList and instead populate it via defineProperties with
>> indexes.  You could also populate it with defineProperties for known
>>child
>> tag names and have the getter call child() or attribute().  They
>>advantage
>> of that is that it would work in more cases where the developer has not
>> strongly typed their code.  But if you do that, you would need those
>>_as3_
>> prefixes.
>
>I’m with you on the defineProperties on XMLList. I’ve already started
>working on that. I’m not sure what that has to do with the prefixes.
>
>My point is that if we’re not using simple object notation to reference
>elements, but we strictly use .child() instead, there will be no
>conflicts with function calls. As long as there’s no functions which use
>numbers, we should have no conflicts. Am I missing something?

A lot of AS code currently “just runs” even though you’ve lost the true
type of the object.

[Event(“ready”)]
public class MyClass extends EventDispatcher
{
  public var myXML:XML;
}

var foo:MyClass = new MyClass();
foo.addEventListener(“ready”, readyHandler);

private function readyHandler(event:Event):void
{
  trace(event.target.myXML.foo);
}

The compiler does not know that myXML is from myClass so it would simply
add a property access to foo.  Now we could require that folks more
strongly type their code by adding in

  trace((event.target.myXML as XMLList).foo);


But we might get complaints.  The fact we normally don’t need all that
casting is what can make AS more efficient than languages that require the
casting like Java and C++.


>
>>> 
>>> I’m not totally clear on exactly how we’re going to handle all the
>>> filters. I think we still need some discussion on that, but let’s get
>>>the
>>> basics straight first.
>> 
>> The proposal is that you add an _as3_filter() function to XMLList.  It
>> takes a function.  You pass that function each node and it returns true
>>or
>> false.
>
>Right. I’m just not totally sure how the expressions get converted into
>the function calls and what the function calls will look like. E4X
>expressions can get pretty “expressive”… ;-)

So for now, the compiler handles any expression where the first
identifiers are expected to be applied to each node.

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
On Nov 15, 2015, at 4:55 PM, Alex Harui <ah...@adobe.com> wrote:

> 
> 
> On 11/15/15, 12:45 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> I was not thinking very clearly last week when we had this discussion.
>> We’re missing a very important piece here:
>> 
>> xml.foo returns an XMLList and not an XML object. If you have some xml
>> like this: <root><foo id=“1”/><baz id=“1”/><foo id=“2”/></root>, xml.foo
>> will give you an XMLList with 2 foo elements xml.baz will give you an
>> XMLList with 1 element, and xml.children() will give you an XMLList with
>> all three in the order of foo@id=1,baz@id=1 and foo@id=2.
>> 
>> Using simple object notation will not work correctly for this because
>> there can be only one object per key. Using arrays or array-like objects
>> (xml.foo = [foo@id=1,foo@id=2]) will not work either because we need to
>> keep the order of elements (i.e. baz needs to be between the two foos)
>> 
>> Additionally, calling xmlList.foo will return an XMLList of all foo
>> elements of all the XML objects in the XMLList.
>> 
>> So, here’s how I think we need to handle this:
>> 
>> 1. XML.foo() or XMLList.foo(), the code should remain .foo() on the JS
>> side. I do not see any need to add the _as3_ prepend.
>> 2. XML.foo or XMLList.foo, that should become XML.child(‘foo”) and
>> XMLList.child(“foo”).
>> 3. XML.@foo and XMLList.@foo should become XML.attribute(“foo”) and
>> XMLList.attribute(“foo”).
> 
> I will look #2 and #3.
> 
> For #1, my thoughts were that you would not use Array as the base class
> for XML and XMLList and instead populate it via defineProperties with
> indexes.  You could also populate it with defineProperties for known child
> tag names and have the getter call child() or attribute().  They advantage
> of that is that it would work in more cases where the developer has not
> strongly typed their code.  But if you do that, you would need those _as3_
> prefixes.

I’m with you on the defineProperties on XMLList. I’ve already started working on that. I’m not sure what that has to do with the prefixes.

My point is that if we’re not using simple object notation to reference elements, but we strictly use .child() instead, there will be no conflicts with function calls. As long as there’s no functions which use numbers, we should have no conflicts. Am I missing something?

>> 
>> I’m not totally clear on exactly how we’re going to handle all the
>> filters. I think we still need some discussion on that, but let’s get the
>> basics straight first.
> 
> The proposal is that you add an _as3_filter() function to XMLList.  It
> takes a function.  You pass that function each node and it returns true or
> false.

Right. I’m just not totally sure how the expressions get converted into the function calls and what the function calls will look like. E4X expressions can get pretty “expressive”… ;-)


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 11/15/15, 12:45 AM, "Harbs" <ha...@gmail.com> wrote:

>I was not thinking very clearly last week when we had this discussion.
>We’re missing a very important piece here:
>
>xml.foo returns an XMLList and not an XML object. If you have some xml
>like this: <root><foo id=“1”/><baz id=“1”/><foo id=“2”/></root>, xml.foo
>will give you an XMLList with 2 foo elements xml.baz will give you an
>XMLList with 1 element, and xml.children() will give you an XMLList with
>all three in the order of foo@id=1,baz@id=1 and foo@id=2.
>
>Using simple object notation will not work correctly for this because
>there can be only one object per key. Using arrays or array-like objects
>(xml.foo = [foo@id=1,foo@id=2]) will not work either because we need to
>keep the order of elements (i.e. baz needs to be between the two foos)
>
>Additionally, calling xmlList.foo will return an XMLList of all foo
>elements of all the XML objects in the XMLList.
>
>So, here’s how I think we need to handle this:
>
>1. XML.foo() or XMLList.foo(), the code should remain .foo() on the JS
>side. I do not see any need to add the _as3_ prepend.
>2. XML.foo or XMLList.foo, that should become XML.child(‘foo”) and
>XMLList.child(“foo”).
>3. XML.@foo and XMLList.@foo should become XML.attribute(“foo”) and
>XMLList.attribute(“foo”).

I will look #2 and #3.

For #1, my thoughts were that you would not use Array as the base class
for XML and XMLList and instead populate it via defineProperties with
indexes.  You could also populate it with defineProperties for known child
tag names and have the getter call child() or attribute().  They advantage
of that is that it would work in more cases where the developer has not
strongly typed their code.  But if you do that, you would need those _as3_
prefixes.

>
>I’m not totally clear on exactly how we’re going to handle all the
>filters. I think we still need some discussion on that, but let’s get the
>basics straight first.

The proposal is that you add an _as3_filter() function to XMLList.  It
takes a function.  You pass that function each node and it returns true or
false.



Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
I was not thinking very clearly last week when we had this discussion. We’re missing a very important piece here:

xml.foo returns an XMLList and not an XML object. If you have some xml like this: <root><foo id=“1”/><baz id=“1”/><foo id=“2”/></root>, xml.foo will give you an XMLList with 2 foo elements xml.baz will give you an XMLList with 1 element, and xml.children() will give you an XMLList with all three in the order of foo@id=1,baz@id=1 and foo@id=2.

Using simple object notation will not work correctly for this because there can be only one object per key. Using arrays or array-like objects (xml.foo = [foo@id=1,foo@id=2]) will not work either because we need to keep the order of elements (i.e. baz needs to be between the two foos)

Additionally, calling xmlList.foo will return an XMLList of all foo elements of all the XML objects in the XMLList.

So, here’s how I think we need to handle this:

1. XML.foo() or XMLList.foo(), the code should remain .foo() on the JS side. I do not see any need to add the _as3_ prepend.
2. XML.foo or XMLList.foo, that should become XML.child(‘foo”) and XMLList.child(“foo”).
3. XML.@foo and XMLList.@foo should become XML.attribute(“foo”) and XMLList.attribute(“foo”).

I’m not totally clear on exactly how we’re going to handle all the filters. I think we still need some discussion on that, but let’s get the basics straight first.

Harbs

On Nov 12, 2015, at 11:58 PM, Harbs <ha...@gmail.com> wrote:

> That looks like about it.
> 
> Putting off #6 is fine for now.
> 
> 7) We’re also going to have to map any XML function call to the version with the prepend.
> 
> I have a really busy weekend (my son’s bar mitzvah is this week), so it’s likely that I’m not going to have anything to commit until sometime next week.
> 
> I’m glad we found something that looks like it should work.
> 
> Harbs
> 
> On Nov 12, 2015, at 11:43 PM, Alex Harui <ah...@adobe.com> wrote:
> 
>> OK, it’s a deal.  I will look into some changes to the compiler.
>> 
>> I think the changes are:
>> 1) XML literals will call "new XML(literal_as_string)" and your code will
>> parse the string
>> 2) delete on XMLList will call _as3_removeChild() but delete on XML just
>> does delete
>> 3) all function calls on XML and XMLList will be prepended with “_as3_”
>> 4) .. will result in calls to _as3_descendants()
>> 5) @ will result in a call to _as3_attribute()
>> 6) filters (@attr == “bar”) results in a call to
>> _as3_filter(Function(node:XML):Boolean)
>> 
>> Can we put of #6 for a while?  Did I leave anything out?
>> 
>> -Alex
>> 
>> On 11/12/15, 1:34 PM, "Harbs" <ha...@gmail.com> wrote:
>> 
>>> Prepending a decoration might work. I’d probably pick something like
>>> “_as3_” rather than “AS3” for the reason that it looks more like a
>>> prepend to the name and it makes the unlikely chance that someone has an
>>> element with the prepended namespace even more unlikely.
>>> 
>>> defineProperty with one extra index might work. I’ll give that a go…
>>> 
>>> On Nov 12, 2015, at 11:18 PM, Alex Harui <ah...@adobe.com> wrote:
>>> 
>>>> 
>>>> 
>>>> On 11/12/15, 12:48 PM, "Harbs" <ha...@gmail.com> wrote:
>>>> 
>>>>> What I mean was that the dynamic object structure could be a property
>>>>> of
>>>>> XML rather than being XML itself.
>>>>> 
>>>>> So the API would be XML which would have all the necessary functions,
>>>>> but
>>>>> it would keep a living structure as a separate dynamic object.
>>>>> 
>>>>> If the compiler could modify all delete operator calls on XML
>>>>> properties
>>>>> to the corresponding dynamic object within, that might solve this
>>>>> issue.
>>>> 
>>>> I’m worried that proxy-ing properties to an internal object will result
>>>> in
>>>> performance problems, bloat the code, make it harder to debug on the JS
>>>> side (should you need to).  Having properties on the XML instance itself
>>>> would probably let code run correctly where we didn’t know it was XML
>>>> (and
>>>> thought it was Object).
>>>> 
>>>> I just noticed that in Flash, the XML methods are in the AS3 namespace,
>>>> which is why they don’t collide with the child “name” tag.  I think it
>>>> might be easier to catch that the function call resolved to that
>>>> namespace
>>>> and prepend a decoration on the function name.
>>>> 
>>>> Then you would write your XML class as:
>>>> 
>>>> public class XML()
>>>> {
>>>> public function AS3name():XMLList
>>>> {
>>>>  ..
>>>> }
>>>> }
>>>> 
>>>>> 
>>>>> Regarding #2: Yes. It’s probably possible to substitute writing to
>>>>> XMLList to modifying XML instead, changing XMLList is VERY common, and
>>>>> if
>>>>> we’re trying to accommodate existing code, there’s going to be lots of
>>>>> bad code. It’s also almost always easier to write to XMLList than it is
>>>>> to XML. Another part of the problem is that I think a lot of folks
>>>>> don’t
>>>>> have the distinction between XMLList and XML clear in certai use cases.
>>>>> This is especially true because single item XMLLists almost always
>>>>> behave
>>>>> as if they are XML objects.
>>>> 
>>>> Well, if you find the defineProperties trick acceptable, I think it
>>>> would
>>>> work in most of these cases.
>>>> 
>>>> Thoughts?
>>>> -Alex
>>>> 
>>> 
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Cool!

I’ll give it a go next week.

On Nov 13, 2015, at 9:30 AM, Alex Harui <ah...@adobe.com> wrote:

> Interesting.  I think I got simple support for this stuff up and running
> in the compiler.  Even simple filters.  I’m sure there will be bugs, but
> give it a try when you get a chance and let me know what you find.
> 
> I did decide to change XMLList.removeChild to XMLList.removeChildAt in
> order to better handle
> 
>    delete myXMLList[0];
> 
> -Alex
> 
> On 11/12/15, 2:29 PM, "Alex Harui" <ah...@adobe.com> wrote:
> 
>> 
>> 
>> On 11/12/15, 1:58 PM, "Harbs" <ha...@gmail.com> wrote:
>> 
>>> I have a really busy weekend (my son’s bar mitzvah is this week), so it’s
>>> likely that I’m not going to have anything to commit until sometime next
>>> week.
>>> 
>>> I’m glad we found something that looks like it should work.
>> 
>> No worries about the schedule.  I’ve got plenty to do.
>> 
>> -Alex
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Alex Harui <ah...@adobe.com>.
Interesting.  I think I got simple support for this stuff up and running
in the compiler.  Even simple filters.  I’m sure there will be bugs, but
give it a try when you get a chance and let me know what you find.

I did decide to change XMLList.removeChild to XMLList.removeChildAt in
order to better handle

    delete myXMLList[0];

-Alex

On 11/12/15, 2:29 PM, "Alex Harui" <ah...@adobe.com> wrote:

>
>
>On 11/12/15, 1:58 PM, "Harbs" <ha...@gmail.com> wrote:
>
>>I have a really busy weekend (my son’s bar mitzvah is this week), so it’s
>>likely that I’m not going to have anything to commit until sometime next
>>week.
>>
>>I’m glad we found something that looks like it should work.
>
>No worries about the schedule.  I’ve got plenty to do.
>
>-Alex
>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 11/12/15, 1:58 PM, "Harbs" <ha...@gmail.com> wrote:

>I have a really busy weekend (my son’s bar mitzvah is this week), so it’s
>likely that I’m not going to have anything to commit until sometime next
>week.
>
>I’m glad we found something that looks like it should work.

No worries about the schedule.  I’ve got plenty to do.

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
That looks like about it.

Putting off #6 is fine for now.

7) We’re also going to have to map any XML function call to the version with the prepend.

I have a really busy weekend (my son’s bar mitzvah is this week), so it’s likely that I’m not going to have anything to commit until sometime next week.

I’m glad we found something that looks like it should work.

Harbs

On Nov 12, 2015, at 11:43 PM, Alex Harui <ah...@adobe.com> wrote:

> OK, it’s a deal.  I will look into some changes to the compiler.
> 
> I think the changes are:
> 1) XML literals will call "new XML(literal_as_string)" and your code will
> parse the string
> 2) delete on XMLList will call _as3_removeChild() but delete on XML just
> does delete
> 3) all function calls on XML and XMLList will be prepended with “_as3_”
> 4) .. will result in calls to _as3_descendants()
> 5) @ will result in a call to _as3_attribute()
> 6) filters (@attr == “bar”) results in a call to
> _as3_filter(Function(node:XML):Boolean)
> 
> Can we put of #6 for a while?  Did I leave anything out?
> 
> -Alex
> 
> On 11/12/15, 1:34 PM, "Harbs" <ha...@gmail.com> wrote:
> 
>> Prepending a decoration might work. I’d probably pick something like
>> “_as3_” rather than “AS3” for the reason that it looks more like a
>> prepend to the name and it makes the unlikely chance that someone has an
>> element with the prepended namespace even more unlikely.
>> 
>> defineProperty with one extra index might work. I’ll give that a go…
>> 
>> On Nov 12, 2015, at 11:18 PM, Alex Harui <ah...@adobe.com> wrote:
>> 
>>> 
>>> 
>>> On 11/12/15, 12:48 PM, "Harbs" <ha...@gmail.com> wrote:
>>> 
>>>> What I mean was that the dynamic object structure could be a property
>>>> of
>>>> XML rather than being XML itself.
>>>> 
>>>> So the API would be XML which would have all the necessary functions,
>>>> but
>>>> it would keep a living structure as a separate dynamic object.
>>>> 
>>>> If the compiler could modify all delete operator calls on XML
>>>> properties
>>>> to the corresponding dynamic object within, that might solve this
>>>> issue.
>>> 
>>> I’m worried that proxy-ing properties to an internal object will result
>>> in
>>> performance problems, bloat the code, make it harder to debug on the JS
>>> side (should you need to).  Having properties on the XML instance itself
>>> would probably let code run correctly where we didn’t know it was XML
>>> (and
>>> thought it was Object).
>>> 
>>> I just noticed that in Flash, the XML methods are in the AS3 namespace,
>>> which is why they don’t collide with the child “name” tag.  I think it
>>> might be easier to catch that the function call resolved to that
>>> namespace
>>> and prepend a decoration on the function name.
>>> 
>>> Then you would write your XML class as:
>>> 
>>> public class XML()
>>> {
>>>  public function AS3name():XMLList
>>>  {
>>>   ..
>>>  }
>>> }
>>> 
>>>> 
>>>> Regarding #2: Yes. It’s probably possible to substitute writing to
>>>> XMLList to modifying XML instead, changing XMLList is VERY common, and
>>>> if
>>>> we’re trying to accommodate existing code, there’s going to be lots of
>>>> bad code. It’s also almost always easier to write to XMLList than it is
>>>> to XML. Another part of the problem is that I think a lot of folks
>>>> don’t
>>>> have the distinction between XMLList and XML clear in certai use cases.
>>>> This is especially true because single item XMLLists almost always
>>>> behave
>>>> as if they are XML objects.
>>> 
>>> Well, if you find the defineProperties trick acceptable, I think it
>>> would
>>> work in most of these cases.
>>> 
>>> Thoughts?
>>> -Alex
>>> 
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Alex Harui <ah...@adobe.com>.
OK, it’s a deal.  I will look into some changes to the compiler.

I think the changes are:
1) XML literals will call "new XML(literal_as_string)" and your code will
parse the string
2) delete on XMLList will call _as3_removeChild() but delete on XML just
does delete
3) all function calls on XML and XMLList will be prepended with “_as3_”
4) .. will result in calls to _as3_descendants()
5) @ will result in a call to _as3_attribute()
6) filters (@attr == “bar”) results in a call to
_as3_filter(Function(node:XML):Boolean)

Can we put of #6 for a while?  Did I leave anything out?

-Alex

On 11/12/15, 1:34 PM, "Harbs" <ha...@gmail.com> wrote:

>Prepending a decoration might work. I’d probably pick something like
>“_as3_” rather than “AS3” for the reason that it looks more like a
>prepend to the name and it makes the unlikely chance that someone has an
>element with the prepended namespace even more unlikely.
>
>defineProperty with one extra index might work. I’ll give that a go…
>
>On Nov 12, 2015, at 11:18 PM, Alex Harui <ah...@adobe.com> wrote:
>
>> 
>> 
>> On 11/12/15, 12:48 PM, "Harbs" <ha...@gmail.com> wrote:
>> 
>>> What I mean was that the dynamic object structure could be a property
>>>of
>>> XML rather than being XML itself.
>>> 
>>> So the API would be XML which would have all the necessary functions,
>>>but
>>> it would keep a living structure as a separate dynamic object.
>>> 
>>> If the compiler could modify all delete operator calls on XML
>>>properties
>>> to the corresponding dynamic object within, that might solve this
>>>issue.
>> 
>> I’m worried that proxy-ing properties to an internal object will result
>>in
>> performance problems, bloat the code, make it harder to debug on the JS
>> side (should you need to).  Having properties on the XML instance itself
>> would probably let code run correctly where we didn’t know it was XML
>>(and
>> thought it was Object).
>> 
>> I just noticed that in Flash, the XML methods are in the AS3 namespace,
>> which is why they don’t collide with the child “name” tag.  I think it
>> might be easier to catch that the function call resolved to that
>>namespace
>> and prepend a decoration on the function name.
>> 
>> Then you would write your XML class as:
>> 
>> public class XML()
>> {
>>   public function AS3name():XMLList
>>   {
>>    ..
>>   }
>> }
>> 
>>> 
>>> Regarding #2: Yes. It’s probably possible to substitute writing to
>>> XMLList to modifying XML instead, changing XMLList is VERY common, and
>>>if
>>> we’re trying to accommodate existing code, there’s going to be lots of
>>> bad code. It’s also almost always easier to write to XMLList than it is
>>> to XML. Another part of the problem is that I think a lot of folks
>>>don’t
>>> have the distinction between XMLList and XML clear in certai use cases.
>>> This is especially true because single item XMLLists almost always
>>>behave
>>> as if they are XML objects.
>> 
>> Well, if you find the defineProperties trick acceptable, I think it
>>would
>> work in most of these cases.
>> 
>> Thoughts?
>> -Alex
>> 
>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Prepending a decoration might work. I’d probably pick something like “_as3_” rather than “AS3” for the reason that it looks more like a prepend to the name and it makes the unlikely chance that someone has an element with the prepended namespace even more unlikely.

defineProperty with one extra index might work. I’ll give that a go…

On Nov 12, 2015, at 11:18 PM, Alex Harui <ah...@adobe.com> wrote:

> 
> 
> On 11/12/15, 12:48 PM, "Harbs" <ha...@gmail.com> wrote:
> 
>> What I mean was that the dynamic object structure could be a property of
>> XML rather than being XML itself.
>> 
>> So the API would be XML which would have all the necessary functions, but
>> it would keep a living structure as a separate dynamic object.
>> 
>> If the compiler could modify all delete operator calls on XML properties
>> to the corresponding dynamic object within, that might solve this issue.
> 
> I’m worried that proxy-ing properties to an internal object will result in
> performance problems, bloat the code, make it harder to debug on the JS
> side (should you need to).  Having properties on the XML instance itself
> would probably let code run correctly where we didn’t know it was XML (and
> thought it was Object).
> 
> I just noticed that in Flash, the XML methods are in the AS3 namespace,
> which is why they don’t collide with the child “name” tag.  I think it
> might be easier to catch that the function call resolved to that namespace
> and prepend a decoration on the function name.
> 
> Then you would write your XML class as:
> 
> public class XML()
> {
>   public function AS3name():XMLList
>   {
>    ..
>   }
> }
> 
>> 
>> Regarding #2: Yes. It’s probably possible to substitute writing to
>> XMLList to modifying XML instead, changing XMLList is VERY common, and if
>> we’re trying to accommodate existing code, there’s going to be lots of
>> bad code. It’s also almost always easier to write to XMLList than it is
>> to XML. Another part of the problem is that I think a lot of folks don’t
>> have the distinction between XMLList and XML clear in certai use cases.
>> This is especially true because single item XMLLists almost always behave
>> as if they are XML objects.
> 
> Well, if you find the defineProperties trick acceptable, I think it would
> work in most of these cases.
> 
> Thoughts?
> -Alex
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 11/12/15, 12:48 PM, "Harbs" <ha...@gmail.com> wrote:

>What I mean was that the dynamic object structure could be a property of
>XML rather than being XML itself.
>
>So the API would be XML which would have all the necessary functions, but
>it would keep a living structure as a separate dynamic object.
>
>If the compiler could modify all delete operator calls on XML properties
>to the corresponding dynamic object within, that might solve this issue.

I’m worried that proxy-ing properties to an internal object will result in
performance problems, bloat the code, make it harder to debug on the JS
side (should you need to).  Having properties on the XML instance itself
would probably let code run correctly where we didn’t know it was XML (and
thought it was Object).

I just noticed that in Flash, the XML methods are in the AS3 namespace,
which is why they don’t collide with the child “name” tag.  I think it
might be easier to catch that the function call resolved to that namespace
and prepend a decoration on the function name.

Then you would write your XML class as:

public class XML()
{
   public function AS3name():XMLList
   {
    ..
   }
}

>
>Regarding #2: Yes. It’s probably possible to substitute writing to
>XMLList to modifying XML instead, changing XMLList is VERY common, and if
>we’re trying to accommodate existing code, there’s going to be lots of
>bad code. It’s also almost always easier to write to XMLList than it is
>to XML. Another part of the problem is that I think a lot of folks don’t
>have the distinction between XMLList and XML clear in certai use cases.
>This is especially true because single item XMLLists almost always behave
>as if they are XML objects.

Well, if you find the defineProperties trick acceptable, I think it would
work in most of these cases.

Thoughts?
-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
What I mean was that the dynamic object structure could be a property of XML rather than being XML itself.

So the API would be XML which would have all the necessary functions, but it would keep a living structure as a separate dynamic object.

If the compiler could modify all delete operator calls on XML properties to the corresponding dynamic object within, that might solve this issue.

Regarding #2: Yes. It’s probably possible to substitute writing to XMLList to modifying XML instead, changing XMLList is VERY common, and if we’re trying to accommodate existing code, there’s going to be lots of bad code. It’s also almost always easier to write to XMLList than it is to XML. Another part of the problem is that I think a lot of folks don’t have the distinction between XMLList and XML clear in certai use cases. This is especially true because single item XMLLists almost always behave as if they are XML objects.

On Nov 12, 2015, at 10:36 PM, Alex Harui <ah...@adobe.com> wrote:

> I only read this article quickly.  I’m not sure what you mean by “proxies
> to XML.xmlObj”.
> 
> My takeaway from the article is that the XML class you are writing will
> need to handle
> 
> 	new XML(someString)
> 
> by implementing one of the conversions.  I didn’t know about JXON until
> you posted the link just now, but I was thinking along the same lines.
> The attributes and children would be properties on the XML instance.  Then
> the delete operator would automatically do the right thing.
> 
> I don’t think the article covered two of the issues you raised:
> 1) a child tag <name /> conflicting with the name() function and other
> collisions like that.
> 2) how to track mutation of an XMLList back to the XML.
> 
> I don’t think e4x-like query results was in the scope of the article.
> 
> I was just looking at how the delete operator gets parsed.  I think it
> will be possible, if we know the object is XMLList, to call a
> removeChild() function.
> 
> The answer for #1 might be similar.  We might try to detect function calls
> on objects of type XML and XMLList and call the functions with a decorated
> name.  I should add that doing so wouldn’t help folks who are trying to
> use your XML classes from native JS.  This approach requires the class
> substitutions that FalconJX executes when the SWF version (which uses the
> XML and XMLList definitions in playerglobal/airglobal) gets cross-compiled.
> 
> For #2, how bad would it be if the compiler output an error or warning if
> folks write to an XMLList.  Isn’t there always a way to do the same thing
> by direct manipulation of the XML?  Otherwise, you might have to resort to
> using Object.defineProperties and maybe define one extra index that, when
> written to, ands a new extra index.
> 
> Thoughts?
> -Alex
> 
> 
> On 11/12/15, 12:10 PM, "Harbs" <ha...@gmail.com> wrote:
> 
>> BTW, there’s a good JXON doc on MDN here[1]
>> 
>> Maybe there’s some way to have a dynamic object as a property of XML so
>> all XML methods could get proxied to XML.xmlObj?
>> 
>> [1]https://developer.mozilla.org/en-US/docs/JXON
>> 
>> On Nov 12, 2015, at 10:02 PM, Harbs <ha...@gmail.com> wrote:
>> 
>>>> So, given all that, if your XML class is dynamic, and attributes are
>>>> just
>>>> added to the instance as properties with the @prefix and child nodes
>>>> are
>>>> arrays of the child node name, I think that delete will do the right
>>>> thing.
>>> 
>>> Yes. attributes can be prefixed with “@“, but what about element names
>>> which might conflict with function names? For example I could easily see
>>> someone have some xml which looks like this:<catalog><name
>>> title=“something”/></catalog> “name would then conflict with “name()”.
>>> 
>>> I was thinking of having one array of elements and another for
>>> properties. Mapping delete to something like that sounds tricky.
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
This was the approach that I started with, but I changed to mimicking the standard XML class in JS so existing XML code can be used without modification.

I do think that approach has merit (especially because it allows us to improve on the current external API), and once I have the JS side of standard XML, I might actually do that.

On Nov 12, 2015, at 10:50 PM, OmPrakash Muppirala <bi...@gmail.com> wrote:

> I'm sorry if this approach was discussed and discarded, but here it is
> anyway:
> 
> 1.  Create a new XML class type in actionscript
> 2.  Immediately convert it into an actionscript object using the
> mx.rpc.xml.XMLDecoder class
> 3.  Provide the usual public apis to the XML class
> 4.  Internally, do all the actions on the actionscript object
> 5.  Implement XML.xml() or  XML.toString() to internally convert the
> actionscript object into XML using the mx.rpc.xml.XMLEncoder class.
> 
> On the JS side, do the same, except use JXON?
> 
> Thanks,
> Om
> 
> On Thu, Nov 12, 2015 at 12:36 PM, Alex Harui <ah...@adobe.com> wrote:
> 
>> I only read this article quickly.  I’m not sure what you mean by “proxies
>> to XML.xmlObj”.
>> 
>> My takeaway from the article is that the XML class you are writing will
>> need to handle
>> 
>>        new XML(someString)
>> 
>> by implementing one of the conversions.  I didn’t know about JXON until
>> you posted the link just now, but I was thinking along the same lines.
>> The attributes and children would be properties on the XML instance.  Then
>> the delete operator would automatically do the right thing.
>> 
>> I don’t think the article covered two of the issues you raised:
>> 1) a child tag <name /> conflicting with the name() function and other
>> collisions like that.
>> 2) how to track mutation of an XMLList back to the XML.
>> 
>> I don’t think e4x-like query results was in the scope of the article.
>> 
>> I was just looking at how the delete operator gets parsed.  I think it
>> will be possible, if we know the object is XMLList, to call a
>> removeChild() function.
>> 
>> The answer for #1 might be similar.  We might try to detect function calls
>> on objects of type XML and XMLList and call the functions with a decorated
>> name.  I should add that doing so wouldn’t help folks who are trying to
>> use your XML classes from native JS.  This approach requires the class
>> substitutions that FalconJX executes when the SWF version (which uses the
>> XML and XMLList definitions in playerglobal/airglobal) gets cross-compiled.
>> 
>> For #2, how bad would it be if the compiler output an error or warning if
>> folks write to an XMLList.  Isn’t there always a way to do the same thing
>> by direct manipulation of the XML?  Otherwise, you might have to resort to
>> using Object.defineProperties and maybe define one extra index that, when
>> written to, ands a new extra index.
>> 
>> Thoughts?
>> -Alex
>> 
>> 
>> On 11/12/15, 12:10 PM, "Harbs" <ha...@gmail.com> wrote:
>> 
>>> BTW, there’s a good JXON doc on MDN here[1]
>>> 
>>> Maybe there’s some way to have a dynamic object as a property of XML so
>>> all XML methods could get proxied to XML.xmlObj?
>>> 
>>> [1]https://developer.mozilla.org/en-US/docs/JXON
>>> 
>>> On Nov 12, 2015, at 10:02 PM, Harbs <ha...@gmail.com> wrote:
>>> 
>>>>> So, given all that, if your XML class is dynamic, and attributes are
>>>>> just
>>>>> added to the instance as properties with the @prefix and child nodes
>>>>> are
>>>>> arrays of the child node name, I think that delete will do the right
>>>>> thing.
>>>> 
>>>> Yes. attributes can be prefixed with “@“, but what about element names
>>>> which might conflict with function names? For example I could easily see
>>>> someone have some xml which looks like this:<catalog><name
>>>> title=“something”/></catalog> “name would then conflict with “name()”.
>>>> 
>>>> I was thinking of having one array of elements and another for
>>>> properties. Mapping delete to something like that sounds tricky.
>>> 
>> 
>> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by OmPrakash Muppirala <bi...@gmail.com>.
I'm sorry if this approach was discussed and discarded, but here it is
anyway:

1.  Create a new XML class type in actionscript
2.  Immediately convert it into an actionscript object using the
mx.rpc.xml.XMLDecoder class
3.  Provide the usual public apis to the XML class
4.  Internally, do all the actions on the actionscript object
5.  Implement XML.xml() or  XML.toString() to internally convert the
actionscript object into XML using the mx.rpc.xml.XMLEncoder class.

On the JS side, do the same, except use JXON?

Thanks,
Om

On Thu, Nov 12, 2015 at 12:36 PM, Alex Harui <ah...@adobe.com> wrote:

> I only read this article quickly.  I’m not sure what you mean by “proxies
> to XML.xmlObj”.
>
> My takeaway from the article is that the XML class you are writing will
> need to handle
>
>         new XML(someString)
>
> by implementing one of the conversions.  I didn’t know about JXON until
> you posted the link just now, but I was thinking along the same lines.
> The attributes and children would be properties on the XML instance.  Then
> the delete operator would automatically do the right thing.
>
> I don’t think the article covered two of the issues you raised:
> 1) a child tag <name /> conflicting with the name() function and other
> collisions like that.
> 2) how to track mutation of an XMLList back to the XML.
>
> I don’t think e4x-like query results was in the scope of the article.
>
> I was just looking at how the delete operator gets parsed.  I think it
> will be possible, if we know the object is XMLList, to call a
> removeChild() function.
>
> The answer for #1 might be similar.  We might try to detect function calls
> on objects of type XML and XMLList and call the functions with a decorated
> name.  I should add that doing so wouldn’t help folks who are trying to
> use your XML classes from native JS.  This approach requires the class
> substitutions that FalconJX executes when the SWF version (which uses the
> XML and XMLList definitions in playerglobal/airglobal) gets cross-compiled.
>
> For #2, how bad would it be if the compiler output an error or warning if
> folks write to an XMLList.  Isn’t there always a way to do the same thing
> by direct manipulation of the XML?  Otherwise, you might have to resort to
> using Object.defineProperties and maybe define one extra index that, when
> written to, ands a new extra index.
>
> Thoughts?
> -Alex
>
>
> On 11/12/15, 12:10 PM, "Harbs" <ha...@gmail.com> wrote:
>
> >BTW, there’s a good JXON doc on MDN here[1]
> >
> >Maybe there’s some way to have a dynamic object as a property of XML so
> >all XML methods could get proxied to XML.xmlObj?
> >
> >[1]https://developer.mozilla.org/en-US/docs/JXON
> >
> >On Nov 12, 2015, at 10:02 PM, Harbs <ha...@gmail.com> wrote:
> >
> >>> So, given all that, if your XML class is dynamic, and attributes are
> >>>just
> >>> added to the instance as properties with the @prefix and child nodes
> >>>are
> >>> arrays of the child node name, I think that delete will do the right
> >>>thing.
> >>
> >> Yes. attributes can be prefixed with “@“, but what about element names
> >>which might conflict with function names? For example I could easily see
> >>someone have some xml which looks like this:<catalog><name
> >>title=“something”/></catalog> “name would then conflict with “name()”.
> >>
> >> I was thinking of having one array of elements and another for
> >>properties. Mapping delete to something like that sounds tricky.
> >
>
>

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Alex Harui <ah...@adobe.com>.
I only read this article quickly.  I’m not sure what you mean by “proxies
to XML.xmlObj”.

My takeaway from the article is that the XML class you are writing will
need to handle

	new XML(someString)

by implementing one of the conversions.  I didn’t know about JXON until
you posted the link just now, but I was thinking along the same lines.
The attributes and children would be properties on the XML instance.  Then
the delete operator would automatically do the right thing.

I don’t think the article covered two of the issues you raised:
1) a child tag <name /> conflicting with the name() function and other
collisions like that.
2) how to track mutation of an XMLList back to the XML.

I don’t think e4x-like query results was in the scope of the article.

I was just looking at how the delete operator gets parsed.  I think it
will be possible, if we know the object is XMLList, to call a
removeChild() function.

The answer for #1 might be similar.  We might try to detect function calls
on objects of type XML and XMLList and call the functions with a decorated
name.  I should add that doing so wouldn’t help folks who are trying to
use your XML classes from native JS.  This approach requires the class
substitutions that FalconJX executes when the SWF version (which uses the
XML and XMLList definitions in playerglobal/airglobal) gets cross-compiled.

For #2, how bad would it be if the compiler output an error or warning if
folks write to an XMLList.  Isn’t there always a way to do the same thing
by direct manipulation of the XML?  Otherwise, you might have to resort to
using Object.defineProperties and maybe define one extra index that, when
written to, ands a new extra index.

Thoughts?
-Alex


On 11/12/15, 12:10 PM, "Harbs" <ha...@gmail.com> wrote:

>BTW, there’s a good JXON doc on MDN here[1]
>
>Maybe there’s some way to have a dynamic object as a property of XML so
>all XML methods could get proxied to XML.xmlObj?
>
>[1]https://developer.mozilla.org/en-US/docs/JXON
>
>On Nov 12, 2015, at 10:02 PM, Harbs <ha...@gmail.com> wrote:
>
>>> So, given all that, if your XML class is dynamic, and attributes are
>>>just
>>> added to the instance as properties with the @prefix and child nodes
>>>are
>>> arrays of the child node name, I think that delete will do the right
>>>thing.
>> 
>> Yes. attributes can be prefixed with “@“, but what about element names
>>which might conflict with function names? For example I could easily see
>>someone have some xml which looks like this:<catalog><name
>>title=“something”/></catalog> “name would then conflict with “name()”.
>> 
>> I was thinking of having one array of elements and another for
>>properties. Mapping delete to something like that sounds tricky.
>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
BTW, there’s a good JXON doc on MDN here[1]

Maybe there’s some way to have a dynamic object as a property of XML so all XML methods could get proxied to XML.xmlObj?

[1]https://developer.mozilla.org/en-US/docs/JXON

On Nov 12, 2015, at 10:02 PM, Harbs <ha...@gmail.com> wrote:

>> So, given all that, if your XML class is dynamic, and attributes are just
>> added to the instance as properties with the @prefix and child nodes are
>> arrays of the child node name, I think that delete will do the right thing.
> 
> Yes. attributes can be prefixed with “@“, but what about element names which might conflict with function names? For example I could easily see someone have some xml which looks like this:<catalog><name title=“something”/></catalog> “name would then conflict with “name()”.
> 
> I was thinking of having one array of elements and another for properties. Mapping delete to something like that sounds tricky.


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
I did not think of your case of (obj is Array). Yeah. That could be a problem.

Here’s some examples of how I’ve used XML in the past:

1. myXMLList[myXMLList.length()] = myNewXML. This adds the object to the XML list and inserts it into the underlying XML object. Under the hood this could be something like this: myXMLList[myXMLList.length()-1].parent.insertChildAfter(myXMLList[myXMLList.length()-1]);

2. There’s no good way to delete nodes from XML. The only two ways I know are a) To add the child XML to another XML object b) to use delete. delete only works on XMLLists which have a length of 1. Otherwise you need to reference the XML object within the list. I have no idea why there is not a removeChild() method like there is in modern javascript.

3. I’ve used lots of E4X filters, but I generally steer away from complex filters because I always find them confusing.

4. One common use case for XML (which does not need toXMLString()) is binding to tree components. I’ve always found XML a more natural fit than objects there. (not sure why)

> So, given all that, if your XML class is dynamic, and attributes are just
> added to the instance as properties with the @prefix and child nodes are
> arrays of the child node name, I think that delete will do the right thing.

Yes. attributes can be prefixed with “@“, but what about element names which might conflict with function names? For example I could easily see someone have some xml which looks like this:<catalog><name title=“something”/></catalog> “name would then conflict with “name()”.

I was thinking of having one array of elements and another for properties. Mapping delete to something like that sounds tricky.

On Nov 12, 2015, at 7:28 PM, Alex Harui <ah...@adobe.com> wrote:

> I will spend some time looking into how the compiler sees XML Literals.
> 
> Regarding length(), delete, and extending Array:
> 
> If you extend Array, I would worry that some code like:
> 
> if (obj is Array)
>  createArrayCollection(obj)
> else
>  createXMLListCollection(obj)
> 
> will not do what the developer would expect.  And again, code hinting
> would offer up methods that probably shouldn’t be exposed.
> 
> I can probably teach the compiler to map length() to length, but let’s
> first nail down scenarios so we understand where we can hack and where we
> shouldn’t.  I haven’t written any production apps that use XML, so I am
> relying on input from you and others.
> 
> The key thing about the XML implementation is when you will need to know a
> property (or attribute) changed, if ever.  You would only need to use
> Object.defineProperties to immediately catch changes.  Otherwise, it is
> reasonable to think of the APIs as queries.  XML is defined in
> ActionScript as dynamic.  So really, it may be that you can get quite far
> without immediate change detection.
> 
> Also, I recall past conversations where folks were doing things to XMLList
> that the language guys never anticipated, like adding nodes from some
> other XML tree to ab XMLList.  We have to keep in mind that we may not be
> able to replicate 100% of E4x, but if we can get even 80% there, it will
> be a major savings to folks with existing code bases.
> 
> And, of course, since the implementation should be swappable, we can build
> an implementation that handles the most common cases and allow
> extensibility or full replacement to get other cases.
> 
> So, given all that, if your XML class is dynamic, and attributes are just
> added to the instance as properties with the @prefix and child nodes are
> arrays of the child node name, I think that delete will do the right thing.
> 
> For XMLList, how common is it to delete an index and what does it do (does
> it affect the XML the XMLList came from)?  We are having the compiler map
> E4X syntax into new APIs on XML and XMLList, so maybe we do add a
> removeChild to XML and I can get delete to call it.
> 
> Also, does deleting an index from an XMLList re-order the indexes or just
> set that index to undefined/null.  If the latter, that should be free.
> 
> My understanding of the bigger picture is that folks get some XML,
> manipulate it with E4X, and always call toXMLString() at the end.  If XML
> and XMLList are dynamic, toXMLString can just walk the properties on each
> node and no immediate change detection is needed.  Even length() would
> just walk each property looking for property names that map to numbers and
> return the highest number it found.  That would be slow, but it would work.
> 
> Thoughts?
> -Alex
> 
> 
> On 11/12/15, 7:10 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> Another question regarding FalconJX:
>> 
>> How easy will it be to handle xml literals? The most straightforward way
>> I can think of that would be to convert:
>> var myXML:XML = <root><node name=“fred”/><node name=“John”/></root>;
>> into
>> var myXML:XML = new XML("<root><node name=\“fred\”/><node
>> name=\“John\”/></root>”);
>> 
>> Right now I’m left with three open questions:
>> 
>> 1. Will it be hard to convert XMLList.length() into XMLList.length
>> 2. How can we deal with “delete” in the context of XML
>> 3. How to deal with XML literals
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 11/12/15, 9:28 AM, "Alex Harui" <ah...@adobe.com> wrote:

>I will spend some time looking into how the compiler sees XML Literals.

XML Literals are parsed into a simple set of nodes that should be able to
convert into a String passed into a "new XML" call


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Alex Harui <ah...@adobe.com>.
I will spend some time looking into how the compiler sees XML Literals.

Regarding length(), delete, and extending Array:

If you extend Array, I would worry that some code like:

if (obj is Array)
  createArrayCollection(obj)
else
  createXMLListCollection(obj)

will not do what the developer would expect.  And again, code hinting
would offer up methods that probably shouldn’t be exposed.

I can probably teach the compiler to map length() to length, but let’s
first nail down scenarios so we understand where we can hack and where we
shouldn’t.  I haven’t written any production apps that use XML, so I am
relying on input from you and others.

The key thing about the XML implementation is when you will need to know a
property (or attribute) changed, if ever.  You would only need to use
Object.defineProperties to immediately catch changes.  Otherwise, it is
reasonable to think of the APIs as queries.  XML is defined in
ActionScript as dynamic.  So really, it may be that you can get quite far
without immediate change detection.

Also, I recall past conversations where folks were doing things to XMLList
that the language guys never anticipated, like adding nodes from some
other XML tree to ab XMLList.  We have to keep in mind that we may not be
able to replicate 100% of E4x, but if we can get even 80% there, it will
be a major savings to folks with existing code bases.

And, of course, since the implementation should be swappable, we can build
an implementation that handles the most common cases and allow
extensibility or full replacement to get other cases.

So, given all that, if your XML class is dynamic, and attributes are just
added to the instance as properties with the @prefix and child nodes are
arrays of the child node name, I think that delete will do the right thing.

For XMLList, how common is it to delete an index and what does it do (does
it affect the XML the XMLList came from)?  We are having the compiler map
E4X syntax into new APIs on XML and XMLList, so maybe we do add a
removeChild to XML and I can get delete to call it.

Also, does deleting an index from an XMLList re-order the indexes or just
set that index to undefined/null.  If the latter, that should be free.

My understanding of the bigger picture is that folks get some XML,
manipulate it with E4X, and always call toXMLString() at the end.  If XML
and XMLList are dynamic, toXMLString can just walk the properties on each
node and no immediate change detection is needed.  Even length() would
just walk each property looking for property names that map to numbers and
return the highest number it found.  That would be slow, but it would work.

Thoughts?
-Alex


On 11/12/15, 7:10 AM, "Harbs" <ha...@gmail.com> wrote:

>Another question regarding FalconJX:
>
>How easy will it be to handle xml literals? The most straightforward way
>I can think of that would be to convert:
>var myXML:XML = <root><node name=“fred”/><node name=“John”/></root>;
>into
>var myXML:XML = new XML("<root><node name=\“fred\”/><node
>name=\“John\”/></root>”);
>
>Right now I’m left with three open questions:
>
>1. Will it be hard to convert XMLList.length() into XMLList.length
>2. How can we deal with “delete” in the context of XML
>3. How to deal with XML literals


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Another question regarding FalconJX:

How easy will it be to handle xml literals? The most straightforward way I can think of that would be to convert:
var myXML:XML = <root><node name=“fred”/><node name=“John”/></root>;
into
var myXML:XML = new XML("<root><node name=\“fred\”/><node name=\“John\”/></root>”);

Right now I’m left with three open questions:

1. Will it be hard to convert XMLList.length() into XMLList.length
2. How can we deal with “delete” in the context of XML
3. How to deal with XML literals

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
On Nov 12, 2015, at 6:58 AM, Alex Harui <ah...@adobe.com> wrote:

> 
> 
> On 11/11/15, 4:11 PM, "Harbs" <ha...@gmail.com> wrote:
> 
>> A little update on my progress:
>> 
>> XMLList turned out to be easy with the exception of length(). Most of the
>> functionality is being offloaded to XML.
> 
> I don’t remember what happens to the base XML if you add or remove items
> to an XMLList,

Oh! This brings up an important point! It’s possible to remove XML elements using the global delete keyword so “delete myXML.Harbs” or “delete myXML.Harbs[0]” would get rid of me. I have no idea how to handle that on the JS side.

> but it may not be necessary to subclass Array to get []
> indexing.  And by not subclassing Array, you won’t expose the Array
> methods that don’t exist on XMLList (push, pop, slice, etc).
> 
> One alternate approach is to use Object.defineProperties to define
> properties named “0”, “1”, etc.  You know how many properties you have to
> define since you know the length.  And then you’ll be able to define a
> length() method without a collision with Array.  Of course, I could be
> missing something.

Nice idea, but I don’t think that’s going to work. You can add items to an XMLList using bracket notation as well. So there’s no way to know ahead of time how many indexes you’re going to need.

I personally don’t see the problem with having Array functions on XMLList. It’s a very array-like object and I so no damage in having it behave completely like an array.

Is it a problem to map length() to length in FalconJX?

> 
>> 
>> XML is turning out to be more challenging than I originally thought. It
>> turns out that there’s a pretty big difference between a Document and a
>> Node in HTML while in ActionScript there’s not much difference with the
>> exception of having a parent and an index. At this point, I think I’m
>> only using DOMParser to convert the XML to a walkable tree, but I think
>> it needs to be objects rather than a Document under the hood.
> 
> Right, but wouldn’t the objects be instances of your new XML class?

Yup. I’m just going to have to do all the heavy lifting myself without off-loading it to Document.


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 11/11/15, 4:11 PM, "Harbs" <ha...@gmail.com> wrote:

>A little update on my progress:
>
>XMLList turned out to be easy with the exception of length(). Most of the
>functionality is being offloaded to XML.

I don’t remember what happens to the base XML if you add or remove items
to an XMLList, but it may not be necessary to subclass Array to get []
indexing.  And by not subclassing Array, you won’t expose the Array
methods that don’t exist on XMLList (push, pop, slice, etc).

One alternate approach is to use Object.defineProperties to define
properties named “0”, “1”, etc.  You know how many properties you have to
define since you know the length.  And then you’ll be able to define a
length() method without a collision with Array.  Of course, I could be
missing something.

>
>XML is turning out to be more challenging than I originally thought. It
>turns out that there’s a pretty big difference between a Document and a
>Node in HTML while in ActionScript there’s not much difference with the
>exception of having a parent and an index. At this point, I think I’m
>only using DOMParser to convert the XML to a walkable tree, but I think
>it needs to be objects rather than a Document under the hood.

Right, but wouldn’t the objects be instances of your new XML class?

-Alex


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
A little update on my progress:

XMLList turned out to be easy with the exception of length(). Most of the functionality is being offloaded to XML.

XML is turning out to be more challenging than I originally thought. It turns out that there’s a pretty big difference between a Document and a Node in HTML while in ActionScript there’s not much difference with the exception of having a parent and an index. At this point, I think I’m only using DOMParser to convert the XML to a walkable tree, but I think it needs to be objects rather than a Document under the hood.

Let’s see how I manage to work this out tomorrow…

Harbs

Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Could we just teach the compiler to convert “length()” to “length” which cross-compiling XMLList?

On Nov 11, 2015, at 10:29 PM, Harbs <ha...@gmail.com> wrote:

> Another question:
> 
> I was basing XMLList off Array to handle bracket notation, but I realized that length vs length() will be a problem. Any suggestions on this front?
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Another question:

I was basing XMLList off Array to handle bracket notation, but I realized that length vs length() will be a problem. Any suggestions on this front?


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Quick question to anyone that knows off-hand:

What happens if you call toXMLString() and toString() on an XMLList object that has more than a single child? Does it cause an error or returns something sane?



Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Alex Harui <ah...@adobe.com>.
BTW, I just ran a quick test of adding an XML and XMLList class to the
DragDrop SWC.

I create XML.as in DragDrop/as/src

package
{
  public class XML
  {	  
    public function XML()
    {
    }
  }
}

XMLList is essentially the same.

Then in DragDropClasses I added:

COMPILE::JS
	{
  import XML; XML;
  import XMLList; XMLList;
	}

Then I ran “ant all” and I saw it cross-compile them and the SWF SWC built
without them.

-Alex





On 11/10/15, 2:57 PM, "Harbs" <ha...@gmail.com> wrote:

>OK. I’ll try working with ant for now.
>
>I’ll try getting some code to compile in the morning. If there’s no code
>completion for now anyway, I’ll just set -define=COMPILE::JS,false for
>now. That will at least allow me to use FB as a code editor. Maybe I’ll
>see if Sublime give me some code completion.
>
>I see what you did with gecko_xml.js. If I’m missing anything else, I
>think I understand how to add more externs.
>
>Hopefully I got enough to be productive now.
>
>Wish me luck! ;-)
>
>Harbs
>
>On Nov 11, 2015, at 12:47 AM, Alex Harui <ah...@adobe.com> wrote:
>
>> 
>> 
>> On 11/10/15, 1:50 PM, "Harbs" <ha...@gmail.com> wrote:
>> 
>>> I just tried in Core as well. If I set “-define=COMPILE::JS,true” which
>>> is what I believe we need to get code recognition and completion, I get
>>> lots of errors in FB.
>>> 
>>> Am I going about this wrong?
>> 
>> As I said in at the beginning of my last reply, I don’t know what it
>>will
>> take to get FB to accept these definitions from js.swc.  I understand it
>> will make it easier for you and others to contribute once we get FB
>> working on these projects, but I would much prefer not to have to take
>>the
>> time to figure it out for the core_js_to_as branch until we are mostly
>> done with the back port and have restructured the folders to a more
>>final
>> topology.  Otherwise, I think I will have to keep stopping to tweak the
>> projects as we go and the whole thing will take longer.  Do you really
>> have to have code hinting to get started on this XML library?  Or maybe
>> just start coding it in a temporary package for now.  You can probably
>>add
>> some glue code to the output to map that class to the global scope.
>> 
>> The COMPILE::JS flag only controls what code the compiler has to
>>compile,
>> not what definitions it is pulling in from various SWCs.
>> 
>> From the command-line with Ant, I just tried building the Core project
>>by
>> switching to frameworks/projects/Core and then:
>> 1) ran “ant -Dis.jenkins=true all” which proved it could build cleanly
>>but
>> skipped the tests
>> 2) Edited Application.as and inside a COMPILE::JS block added:
>>    var foo:DOMParser = null;
>>    var bar:Document = null;
>> 3) ran “ant -Dis.jenkins=true all” again to see if would compile.
>> 
>> It was missing DOMParser which I just added and pushed to flex-falcon so
>> sync up and at least run “ant extern.swcs” there.  Then step 3 worked
>>for
>> me.
>> 
>> Please first try the Ant steps so at least we know that works for you.
>> 
>> -Alex
>> 
>>> 
>>> On Nov 10, 2015, at 9:40 PM, Alex Harui <ah...@adobe.com> wrote:
>>> 
>>>>> I’m not sure you answered my primary question here. How do I target
>>>>> HTML/JS native classes like Document, DOMParser, etc. in
>>>>>ActionScript?
>>>>> I
>>>>> don’t want to do that in js. I’d rather have FlaconJX cross-compile
>>>>>it
>>>>> for me.
>>>> 
>>>> Not sure about what FlashBuilder will let you do, but from Ant, you
>>>> should
>>>> be able to use Document, DOMParser etc inside COMPILE::JS blocks.  Try
>>>> adding test code to a class in the Core project and compile it.  Then
>>>> we’ll worry about FlashBuilder.  It should work for Core because the
>>>> compile-asjs phase will not use playerglobal/airglobal, it will use
>>>> js.swc
>>>> from the Falcon repo which has Document and DOMParser in it.
>>> 
>> 
>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Alex Harui <ah...@adobe.com>.
Really, you can choose any baseline you want for your XML SWC.  Folks
targeting something might have to resort to JSON.  Or someone else will
create an IE9 compatible version.  If there is a significant win to having
the baseline be IE10 for your swc, it doesn’t require that for other
classes.  We already have an HTML5 swc that will someday require HTML5
browsers.

-Alex

On 11/10/15, 3:34 PM, "Harbs" <ha...@gmail.com> wrote:

>Great!
>
>Minimum of IE10 would make things even easier, but I think IE9 is fine
>for what I’m working on now.
>
>On Nov 11, 2015, at 1:29 AM, Alex Harui <ah...@adobe.com> wrote:
>
>> We are now saying IE9.  We are using Object.defineProperties.
>> 
>> Folks targeting IE8 and older should deploy the SWF version.
>> 
>> -Alex
>> 
>> On 11/10/15, 3:25 PM, "Harbs" <ha...@gmail.com> wrote:
>> 
>>> BTW, what’s our minimum browser target for FlexJS?
>>> 
>>> Are we supporting IE8? I’m kind of hoping I can ignore IE8 WRT XML
>>> support.
>>> 
>>> On Nov 11, 2015, at 1:20 AM, Alex Harui <ah...@adobe.com> wrote:
>>> 
>>>> Good luck.
>>>> 
>>>> Setting COMPILE::JS should have no effect on code completion offerings
>>>> unless it controls APIs in source code you wrote yourself.  The rest
>>>>of
>>>> the offerings come from the SWCs in the library-path (and
>>>> external-library-path) and which flags were on when the SWC was
>>>> compiled.
>>>> I added some info about that in the wiki page today.
>>>> 
>>>> Having thought about this a bit, I think we will need two sets of
>>>> project
>>>> files for folks to develop components in FB.  I have never tried
>>>>project
>>>> files with external source folders, but I think that is where we’ll
>>>>end
>>>> up.  The default project files may be for SWFs and have
>>>> playerglobal/airglobal as external libraries.  Some other set of
>>>>project
>>>> files will point to the same source folders but have js.swc as an
>>>> external
>>>> library and no sign of playerglobal/airglobal.  If you want to play
>>>> around
>>>> with that, feel free.  Then you should get code hinting from js.swc.
>>>> 
>>>> I think the final folder topology will be quite different from the
>>>> as/src,
>>>> asjs/src, js/src, js/out you’ll find in the branch right now.  I’m
>>>> tempted
>>>> to just have a src folder and an out folder.  Although I’m happy to
>>>>try
>>>> something else, especially if it affects Maven integration.
>>>> 
>>>> -Alex
>>>> 
>>>> On 11/10/15, 2:57 PM, "Harbs" <ha...@gmail.com> wrote:
>>>> 
>>>>> OK. I’ll try working with ant for now.
>>>>> 
>>>>> I’ll try getting some code to compile in the morning. If there’s no
>>>>> code
>>>>> completion for now anyway, I’ll just set -define=COMPILE::JS,false
>>>>>for
>>>>> now. That will at least allow me to use FB as a code editor. Maybe
>>>>>I’ll
>>>>> see if Sublime give me some code completion.
>>>>> 
>>>>> I see what you did with gecko_xml.js. If I’m missing anything else, I
>>>>> think I understand how to add more externs.
>>>>> 
>>>>> Hopefully I got enough to be productive now.
>>>>> 
>>>>> Wish me luck! ;-)
>>>>> 
>>>>> Harbs
>>>>> 
>>>>> On Nov 11, 2015, at 12:47 AM, Alex Harui <ah...@adobe.com> wrote:
>>>>> 
>>>>>> 
>>>>>> 
>>>>>> On 11/10/15, 1:50 PM, "Harbs" <ha...@gmail.com> wrote:
>>>>>> 
>>>>>>> I just tried in Core as well. If I set “-define=COMPILE::JS,true”
>>>>>>> which
>>>>>>> is what I believe we need to get code recognition and completion, I
>>>>>>> get
>>>>>>> lots of errors in FB.
>>>>>>> 
>>>>>>> Am I going about this wrong?
>>>>>> 
>>>>>> As I said in at the beginning of my last reply, I don’t know what it
>>>>>> will
>>>>>> take to get FB to accept these definitions from js.swc.  I
>>>>>>understand
>>>>>> it
>>>>>> will make it easier for you and others to contribute once we get FB
>>>>>> working on these projects, but I would much prefer not to have to
>>>>>>take
>>>>>> the
>>>>>> time to figure it out for the core_js_to_as branch until we are
>>>>>>mostly
>>>>>> done with the back port and have restructured the folders to a more
>>>>>> final
>>>>>> topology.  Otherwise, I think I will have to keep stopping to tweak
>>>>>> the
>>>>>> projects as we go and the whole thing will take longer.  Do you
>>>>>>really
>>>>>> have to have code hinting to get started on this XML library?  Or
>>>>>> maybe
>>>>>> just start coding it in a temporary package for now.  You can
>>>>>>probably
>>>>>> add
>>>>>> some glue code to the output to map that class to the global scope.
>>>>>> 
>>>>>> The COMPILE::JS flag only controls what code the compiler has to
>>>>>> compile,
>>>>>> not what definitions it is pulling in from various SWCs.
>>>>>> 
>>>>>> From the command-line with Ant, I just tried building the Core
>>>>>>project
>>>>>> by
>>>>>> switching to frameworks/projects/Core and then:
>>>>>> 1) ran “ant -Dis.jenkins=true all” which proved it could build
>>>>>>cleanly
>>>>>> but
>>>>>> skipped the tests
>>>>>> 2) Edited Application.as and inside a COMPILE::JS block added:
>>>>>>  var foo:DOMParser = null;
>>>>>>  var bar:Document = null;
>>>>>> 3) ran “ant -Dis.jenkins=true all” again to see if would compile.
>>>>>> 
>>>>>> It was missing DOMParser which I just added and pushed to
>>>>>>flex-falcon
>>>>>> so
>>>>>> sync up and at least run “ant extern.swcs” there.  Then step 3
>>>>>>worked
>>>>>> for
>>>>>> me.
>>>>>> 
>>>>>> Please first try the Ant steps so at least we know that works for
>>>>>>you.
>>>>>> 
>>>>>> -Alex
>>>>>> 
>>>>>>> 
>>>>>>> On Nov 10, 2015, at 9:40 PM, Alex Harui <ah...@adobe.com> wrote:
>>>>>>> 
>>>>>>>>> I’m not sure you answered my primary question here. How do I
>>>>>>>>>target
>>>>>>>>> HTML/JS native classes like Document, DOMParser, etc. in
>>>>>>>>> ActionScript?
>>>>>>>>> I
>>>>>>>>> don’t want to do that in js. I’d rather have FlaconJX
>>>>>>>>>cross-compile
>>>>>>>>> it
>>>>>>>>> for me.
>>>>>>>> 
>>>>>>>> Not sure about what FlashBuilder will let you do, but from Ant,
>>>>>>>>you
>>>>>>>> should
>>>>>>>> be able to use Document, DOMParser etc inside COMPILE::JS blocks.
>>>>>>>> Try
>>>>>>>> adding test code to a class in the Core project and compile it.
>>>>>>>> Then
>>>>>>>> we’ll worry about FlashBuilder.  It should work for Core because
>>>>>>>>the
>>>>>>>> compile-asjs phase will not use playerglobal/airglobal, it will
>>>>>>>>use
>>>>>>>> js.swc
>>>>>>>> from the Falcon repo which has Document and DOMParser in it.
>>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
Great!

Minimum of IE10 would make things even easier, but I think IE9 is fine for what I’m working on now.

On Nov 11, 2015, at 1:29 AM, Alex Harui <ah...@adobe.com> wrote:

> We are now saying IE9.  We are using Object.defineProperties.
> 
> Folks targeting IE8 and older should deploy the SWF version.
> 
> -Alex
> 
> On 11/10/15, 3:25 PM, "Harbs" <ha...@gmail.com> wrote:
> 
>> BTW, what’s our minimum browser target for FlexJS?
>> 
>> Are we supporting IE8? I’m kind of hoping I can ignore IE8 WRT XML
>> support.
>> 
>> On Nov 11, 2015, at 1:20 AM, Alex Harui <ah...@adobe.com> wrote:
>> 
>>> Good luck.
>>> 
>>> Setting COMPILE::JS should have no effect on code completion offerings
>>> unless it controls APIs in source code you wrote yourself.  The rest of
>>> the offerings come from the SWCs in the library-path (and
>>> external-library-path) and which flags were on when the SWC was
>>> compiled.
>>> I added some info about that in the wiki page today.
>>> 
>>> Having thought about this a bit, I think we will need two sets of
>>> project
>>> files for folks to develop components in FB.  I have never tried project
>>> files with external source folders, but I think that is where we’ll end
>>> up.  The default project files may be for SWFs and have
>>> playerglobal/airglobal as external libraries.  Some other set of project
>>> files will point to the same source folders but have js.swc as an
>>> external
>>> library and no sign of playerglobal/airglobal.  If you want to play
>>> around
>>> with that, feel free.  Then you should get code hinting from js.swc.
>>> 
>>> I think the final folder topology will be quite different from the
>>> as/src,
>>> asjs/src, js/src, js/out you’ll find in the branch right now.  I’m
>>> tempted
>>> to just have a src folder and an out folder.  Although I’m happy to try
>>> something else, especially if it affects Maven integration.
>>> 
>>> -Alex
>>> 
>>> On 11/10/15, 2:57 PM, "Harbs" <ha...@gmail.com> wrote:
>>> 
>>>> OK. I’ll try working with ant for now.
>>>> 
>>>> I’ll try getting some code to compile in the morning. If there’s no
>>>> code
>>>> completion for now anyway, I’ll just set -define=COMPILE::JS,false for
>>>> now. That will at least allow me to use FB as a code editor. Maybe I’ll
>>>> see if Sublime give me some code completion.
>>>> 
>>>> I see what you did with gecko_xml.js. If I’m missing anything else, I
>>>> think I understand how to add more externs.
>>>> 
>>>> Hopefully I got enough to be productive now.
>>>> 
>>>> Wish me luck! ;-)
>>>> 
>>>> Harbs
>>>> 
>>>> On Nov 11, 2015, at 12:47 AM, Alex Harui <ah...@adobe.com> wrote:
>>>> 
>>>>> 
>>>>> 
>>>>> On 11/10/15, 1:50 PM, "Harbs" <ha...@gmail.com> wrote:
>>>>> 
>>>>>> I just tried in Core as well. If I set “-define=COMPILE::JS,true”
>>>>>> which
>>>>>> is what I believe we need to get code recognition and completion, I
>>>>>> get
>>>>>> lots of errors in FB.
>>>>>> 
>>>>>> Am I going about this wrong?
>>>>> 
>>>>> As I said in at the beginning of my last reply, I don’t know what it
>>>>> will
>>>>> take to get FB to accept these definitions from js.swc.  I understand
>>>>> it
>>>>> will make it easier for you and others to contribute once we get FB
>>>>> working on these projects, but I would much prefer not to have to take
>>>>> the
>>>>> time to figure it out for the core_js_to_as branch until we are mostly
>>>>> done with the back port and have restructured the folders to a more
>>>>> final
>>>>> topology.  Otherwise, I think I will have to keep stopping to tweak
>>>>> the
>>>>> projects as we go and the whole thing will take longer.  Do you really
>>>>> have to have code hinting to get started on this XML library?  Or
>>>>> maybe
>>>>> just start coding it in a temporary package for now.  You can probably
>>>>> add
>>>>> some glue code to the output to map that class to the global scope.
>>>>> 
>>>>> The COMPILE::JS flag only controls what code the compiler has to
>>>>> compile,
>>>>> not what definitions it is pulling in from various SWCs.
>>>>> 
>>>>> From the command-line with Ant, I just tried building the Core project
>>>>> by
>>>>> switching to frameworks/projects/Core and then:
>>>>> 1) ran “ant -Dis.jenkins=true all” which proved it could build cleanly
>>>>> but
>>>>> skipped the tests
>>>>> 2) Edited Application.as and inside a COMPILE::JS block added:
>>>>>  var foo:DOMParser = null;
>>>>>  var bar:Document = null;
>>>>> 3) ran “ant -Dis.jenkins=true all” again to see if would compile.
>>>>> 
>>>>> It was missing DOMParser which I just added and pushed to flex-falcon
>>>>> so
>>>>> sync up and at least run “ant extern.swcs” there.  Then step 3 worked
>>>>> for
>>>>> me.
>>>>> 
>>>>> Please first try the Ant steps so at least we know that works for you.
>>>>> 
>>>>> -Alex
>>>>> 
>>>>>> 
>>>>>> On Nov 10, 2015, at 9:40 PM, Alex Harui <ah...@adobe.com> wrote:
>>>>>> 
>>>>>>>> I’m not sure you answered my primary question here. How do I target
>>>>>>>> HTML/JS native classes like Document, DOMParser, etc. in
>>>>>>>> ActionScript?
>>>>>>>> I
>>>>>>>> don’t want to do that in js. I’d rather have FlaconJX cross-compile
>>>>>>>> it
>>>>>>>> for me.
>>>>>>> 
>>>>>>> Not sure about what FlashBuilder will let you do, but from Ant, you
>>>>>>> should
>>>>>>> be able to use Document, DOMParser etc inside COMPILE::JS blocks.
>>>>>>> Try
>>>>>>> adding test code to a class in the Core project and compile it.
>>>>>>> Then
>>>>>>> we’ll worry about FlashBuilder.  It should work for Core because the
>>>>>>> compile-asjs phase will not use playerglobal/airglobal, it will use
>>>>>>> js.swc
>>>>>>> from the Falcon repo which has Document and DOMParser in it.
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Alex Harui <ah...@adobe.com>.
We are now saying IE9.  We are using Object.defineProperties.

Folks targeting IE8 and older should deploy the SWF version.

-Alex

On 11/10/15, 3:25 PM, "Harbs" <ha...@gmail.com> wrote:

>BTW, what’s our minimum browser target for FlexJS?
>
>Are we supporting IE8? I’m kind of hoping I can ignore IE8 WRT XML
>support.
>
>On Nov 11, 2015, at 1:20 AM, Alex Harui <ah...@adobe.com> wrote:
>
>> Good luck.
>> 
>> Setting COMPILE::JS should have no effect on code completion offerings
>> unless it controls APIs in source code you wrote yourself.  The rest of
>> the offerings come from the SWCs in the library-path (and
>> external-library-path) and which flags were on when the SWC was
>>compiled.
>> I added some info about that in the wiki page today.
>> 
>> Having thought about this a bit, I think we will need two sets of
>>project
>> files for folks to develop components in FB.  I have never tried project
>> files with external source folders, but I think that is where we’ll end
>> up.  The default project files may be for SWFs and have
>> playerglobal/airglobal as external libraries.  Some other set of project
>> files will point to the same source folders but have js.swc as an
>>external
>> library and no sign of playerglobal/airglobal.  If you want to play
>>around
>> with that, feel free.  Then you should get code hinting from js.swc.
>> 
>> I think the final folder topology will be quite different from the
>>as/src,
>> asjs/src, js/src, js/out you’ll find in the branch right now.  I’m
>>tempted
>> to just have a src folder and an out folder.  Although I’m happy to try
>> something else, especially if it affects Maven integration.
>> 
>> -Alex
>> 
>> On 11/10/15, 2:57 PM, "Harbs" <ha...@gmail.com> wrote:
>> 
>>> OK. I’ll try working with ant for now.
>>> 
>>> I’ll try getting some code to compile in the morning. If there’s no
>>>code
>>> completion for now anyway, I’ll just set -define=COMPILE::JS,false for
>>> now. That will at least allow me to use FB as a code editor. Maybe I’ll
>>> see if Sublime give me some code completion.
>>> 
>>> I see what you did with gecko_xml.js. If I’m missing anything else, I
>>> think I understand how to add more externs.
>>> 
>>> Hopefully I got enough to be productive now.
>>> 
>>> Wish me luck! ;-)
>>> 
>>> Harbs
>>> 
>>> On Nov 11, 2015, at 12:47 AM, Alex Harui <ah...@adobe.com> wrote:
>>> 
>>>> 
>>>> 
>>>> On 11/10/15, 1:50 PM, "Harbs" <ha...@gmail.com> wrote:
>>>> 
>>>>> I just tried in Core as well. If I set “-define=COMPILE::JS,true”
>>>>>which
>>>>> is what I believe we need to get code recognition and completion, I
>>>>>get
>>>>> lots of errors in FB.
>>>>> 
>>>>> Am I going about this wrong?
>>>> 
>>>> As I said in at the beginning of my last reply, I don’t know what it
>>>> will
>>>> take to get FB to accept these definitions from js.swc.  I understand
>>>>it
>>>> will make it easier for you and others to contribute once we get FB
>>>> working on these projects, but I would much prefer not to have to take
>>>> the
>>>> time to figure it out for the core_js_to_as branch until we are mostly
>>>> done with the back port and have restructured the folders to a more
>>>> final
>>>> topology.  Otherwise, I think I will have to keep stopping to tweak
>>>>the
>>>> projects as we go and the whole thing will take longer.  Do you really
>>>> have to have code hinting to get started on this XML library?  Or
>>>>maybe
>>>> just start coding it in a temporary package for now.  You can probably
>>>> add
>>>> some glue code to the output to map that class to the global scope.
>>>> 
>>>> The COMPILE::JS flag only controls what code the compiler has to
>>>> compile,
>>>> not what definitions it is pulling in from various SWCs.
>>>> 
>>>> From the command-line with Ant, I just tried building the Core project
>>>> by
>>>> switching to frameworks/projects/Core and then:
>>>> 1) ran “ant -Dis.jenkins=true all” which proved it could build cleanly
>>>> but
>>>> skipped the tests
>>>> 2) Edited Application.as and inside a COMPILE::JS block added:
>>>>   var foo:DOMParser = null;
>>>>   var bar:Document = null;
>>>> 3) ran “ant -Dis.jenkins=true all” again to see if would compile.
>>>> 
>>>> It was missing DOMParser which I just added and pushed to flex-falcon
>>>>so
>>>> sync up and at least run “ant extern.swcs” there.  Then step 3 worked
>>>> for
>>>> me.
>>>> 
>>>> Please first try the Ant steps so at least we know that works for you.
>>>> 
>>>> -Alex
>>>> 
>>>>> 
>>>>> On Nov 10, 2015, at 9:40 PM, Alex Harui <ah...@adobe.com> wrote:
>>>>> 
>>>>>>> I’m not sure you answered my primary question here. How do I target
>>>>>>> HTML/JS native classes like Document, DOMParser, etc. in
>>>>>>> ActionScript?
>>>>>>> I
>>>>>>> don’t want to do that in js. I’d rather have FlaconJX cross-compile
>>>>>>> it
>>>>>>> for me.
>>>>>> 
>>>>>> Not sure about what FlashBuilder will let you do, but from Ant, you
>>>>>> should
>>>>>> be able to use Document, DOMParser etc inside COMPILE::JS blocks.
>>>>>>Try
>>>>>> adding test code to a class in the Core project and compile it.
>>>>>>Then
>>>>>> we’ll worry about FlashBuilder.  It should work for Core because the
>>>>>> compile-asjs phase will not use playerglobal/airglobal, it will use
>>>>>> js.swc
>>>>>> from the Falcon repo which has Document and DOMParser in it.
>>>>> 
>>>> 
>>> 
>> 
>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
BTW, what’s our minimum browser target for FlexJS?

Are we supporting IE8? I’m kind of hoping I can ignore IE8 WRT XML support.

On Nov 11, 2015, at 1:20 AM, Alex Harui <ah...@adobe.com> wrote:

> Good luck.
> 
> Setting COMPILE::JS should have no effect on code completion offerings
> unless it controls APIs in source code you wrote yourself.  The rest of
> the offerings come from the SWCs in the library-path (and
> external-library-path) and which flags were on when the SWC was compiled.
> I added some info about that in the wiki page today.
> 
> Having thought about this a bit, I think we will need two sets of project
> files for folks to develop components in FB.  I have never tried project
> files with external source folders, but I think that is where we’ll end
> up.  The default project files may be for SWFs and have
> playerglobal/airglobal as external libraries.  Some other set of project
> files will point to the same source folders but have js.swc as an external
> library and no sign of playerglobal/airglobal.  If you want to play around
> with that, feel free.  Then you should get code hinting from js.swc.
> 
> I think the final folder topology will be quite different from the as/src,
> asjs/src, js/src, js/out you’ll find in the branch right now.  I’m tempted
> to just have a src folder and an out folder.  Although I’m happy to try
> something else, especially if it affects Maven integration.
> 
> -Alex
> 
> On 11/10/15, 2:57 PM, "Harbs" <ha...@gmail.com> wrote:
> 
>> OK. I’ll try working with ant for now.
>> 
>> I’ll try getting some code to compile in the morning. If there’s no code
>> completion for now anyway, I’ll just set -define=COMPILE::JS,false for
>> now. That will at least allow me to use FB as a code editor. Maybe I’ll
>> see if Sublime give me some code completion.
>> 
>> I see what you did with gecko_xml.js. If I’m missing anything else, I
>> think I understand how to add more externs.
>> 
>> Hopefully I got enough to be productive now.
>> 
>> Wish me luck! ;-)
>> 
>> Harbs
>> 
>> On Nov 11, 2015, at 12:47 AM, Alex Harui <ah...@adobe.com> wrote:
>> 
>>> 
>>> 
>>> On 11/10/15, 1:50 PM, "Harbs" <ha...@gmail.com> wrote:
>>> 
>>>> I just tried in Core as well. If I set “-define=COMPILE::JS,true” which
>>>> is what I believe we need to get code recognition and completion, I get
>>>> lots of errors in FB.
>>>> 
>>>> Am I going about this wrong?
>>> 
>>> As I said in at the beginning of my last reply, I don’t know what it
>>> will
>>> take to get FB to accept these definitions from js.swc.  I understand it
>>> will make it easier for you and others to contribute once we get FB
>>> working on these projects, but I would much prefer not to have to take
>>> the
>>> time to figure it out for the core_js_to_as branch until we are mostly
>>> done with the back port and have restructured the folders to a more
>>> final
>>> topology.  Otherwise, I think I will have to keep stopping to tweak the
>>> projects as we go and the whole thing will take longer.  Do you really
>>> have to have code hinting to get started on this XML library?  Or maybe
>>> just start coding it in a temporary package for now.  You can probably
>>> add
>>> some glue code to the output to map that class to the global scope.
>>> 
>>> The COMPILE::JS flag only controls what code the compiler has to
>>> compile,
>>> not what definitions it is pulling in from various SWCs.
>>> 
>>> From the command-line with Ant, I just tried building the Core project
>>> by
>>> switching to frameworks/projects/Core and then:
>>> 1) ran “ant -Dis.jenkins=true all” which proved it could build cleanly
>>> but
>>> skipped the tests
>>> 2) Edited Application.as and inside a COMPILE::JS block added:
>>>   var foo:DOMParser = null;
>>>   var bar:Document = null;
>>> 3) ran “ant -Dis.jenkins=true all” again to see if would compile.
>>> 
>>> It was missing DOMParser which I just added and pushed to flex-falcon so
>>> sync up and at least run “ant extern.swcs” there.  Then step 3 worked
>>> for
>>> me.
>>> 
>>> Please first try the Ant steps so at least we know that works for you.
>>> 
>>> -Alex
>>> 
>>>> 
>>>> On Nov 10, 2015, at 9:40 PM, Alex Harui <ah...@adobe.com> wrote:
>>>> 
>>>>>> I’m not sure you answered my primary question here. How do I target
>>>>>> HTML/JS native classes like Document, DOMParser, etc. in
>>>>>> ActionScript?
>>>>>> I
>>>>>> don’t want to do that in js. I’d rather have FlaconJX cross-compile
>>>>>> it
>>>>>> for me.
>>>>> 
>>>>> Not sure about what FlashBuilder will let you do, but from Ant, you
>>>>> should
>>>>> be able to use Document, DOMParser etc inside COMPILE::JS blocks.  Try
>>>>> adding test code to a class in the Core project and compile it.  Then
>>>>> we’ll worry about FlashBuilder.  It should work for Core because the
>>>>> compile-asjs phase will not use playerglobal/airglobal, it will use
>>>>> js.swc
>>>>> from the Falcon repo which has Document and DOMParser in it.
>>>> 
>>> 
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

Setting COMPILE::JS should have no effect on code completion offerings
unless it controls APIs in source code you wrote yourself.  The rest of
the offerings come from the SWCs in the library-path (and
external-library-path) and which flags were on when the SWC was compiled.
I added some info about that in the wiki page today.

Having thought about this a bit, I think we will need two sets of project
files for folks to develop components in FB.  I have never tried project
files with external source folders, but I think that is where we’ll end
up.  The default project files may be for SWFs and have
playerglobal/airglobal as external libraries.  Some other set of project
files will point to the same source folders but have js.swc as an external
library and no sign of playerglobal/airglobal.  If you want to play around
with that, feel free.  Then you should get code hinting from js.swc.

I think the final folder topology will be quite different from the as/src,
asjs/src, js/src, js/out you’ll find in the branch right now.  I’m tempted
to just have a src folder and an out folder.  Although I’m happy to try
something else, especially if it affects Maven integration.

-Alex

On 11/10/15, 2:57 PM, "Harbs" <ha...@gmail.com> wrote:

>OK. I’ll try working with ant for now.
>
>I’ll try getting some code to compile in the morning. If there’s no code
>completion for now anyway, I’ll just set -define=COMPILE::JS,false for
>now. That will at least allow me to use FB as a code editor. Maybe I’ll
>see if Sublime give me some code completion.
>
>I see what you did with gecko_xml.js. If I’m missing anything else, I
>think I understand how to add more externs.
>
>Hopefully I got enough to be productive now.
>
>Wish me luck! ;-)
>
>Harbs
>
>On Nov 11, 2015, at 12:47 AM, Alex Harui <ah...@adobe.com> wrote:
>
>> 
>> 
>> On 11/10/15, 1:50 PM, "Harbs" <ha...@gmail.com> wrote:
>> 
>>> I just tried in Core as well. If I set “-define=COMPILE::JS,true” which
>>> is what I believe we need to get code recognition and completion, I get
>>> lots of errors in FB.
>>> 
>>> Am I going about this wrong?
>> 
>> As I said in at the beginning of my last reply, I don’t know what it
>>will
>> take to get FB to accept these definitions from js.swc.  I understand it
>> will make it easier for you and others to contribute once we get FB
>> working on these projects, but I would much prefer not to have to take
>>the
>> time to figure it out for the core_js_to_as branch until we are mostly
>> done with the back port and have restructured the folders to a more
>>final
>> topology.  Otherwise, I think I will have to keep stopping to tweak the
>> projects as we go and the whole thing will take longer.  Do you really
>> have to have code hinting to get started on this XML library?  Or maybe
>> just start coding it in a temporary package for now.  You can probably
>>add
>> some glue code to the output to map that class to the global scope.
>> 
>> The COMPILE::JS flag only controls what code the compiler has to
>>compile,
>> not what definitions it is pulling in from various SWCs.
>> 
>> From the command-line with Ant, I just tried building the Core project
>>by
>> switching to frameworks/projects/Core and then:
>> 1) ran “ant -Dis.jenkins=true all” which proved it could build cleanly
>>but
>> skipped the tests
>> 2) Edited Application.as and inside a COMPILE::JS block added:
>>    var foo:DOMParser = null;
>>    var bar:Document = null;
>> 3) ran “ant -Dis.jenkins=true all” again to see if would compile.
>> 
>> It was missing DOMParser which I just added and pushed to flex-falcon so
>> sync up and at least run “ant extern.swcs” there.  Then step 3 worked
>>for
>> me.
>> 
>> Please first try the Ant steps so at least we know that works for you.
>> 
>> -Alex
>> 
>>> 
>>> On Nov 10, 2015, at 9:40 PM, Alex Harui <ah...@adobe.com> wrote:
>>> 
>>>>> I’m not sure you answered my primary question here. How do I target
>>>>> HTML/JS native classes like Document, DOMParser, etc. in
>>>>>ActionScript?
>>>>> I
>>>>> don’t want to do that in js. I’d rather have FlaconJX cross-compile
>>>>>it
>>>>> for me.
>>>> 
>>>> Not sure about what FlashBuilder will let you do, but from Ant, you
>>>> should
>>>> be able to use Document, DOMParser etc inside COMPILE::JS blocks.  Try
>>>> adding test code to a class in the Core project and compile it.  Then
>>>> we’ll worry about FlashBuilder.  It should work for Core because the
>>>> compile-asjs phase will not use playerglobal/airglobal, it will use
>>>> js.swc
>>>> from the Falcon repo which has Document and DOMParser in it.
>>> 
>> 
>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
OK. I’ll try working with ant for now.

I’ll try getting some code to compile in the morning. If there’s no code completion for now anyway, I’ll just set -define=COMPILE::JS,false for now. That will at least allow me to use FB as a code editor. Maybe I’ll see if Sublime give me some code completion.

I see what you did with gecko_xml.js. If I’m missing anything else, I think I understand how to add more externs.

Hopefully I got enough to be productive now.

Wish me luck! ;-)

Harbs

On Nov 11, 2015, at 12:47 AM, Alex Harui <ah...@adobe.com> wrote:

> 
> 
> On 11/10/15, 1:50 PM, "Harbs" <ha...@gmail.com> wrote:
> 
>> I just tried in Core as well. If I set “-define=COMPILE::JS,true” which
>> is what I believe we need to get code recognition and completion, I get
>> lots of errors in FB.
>> 
>> Am I going about this wrong?
> 
> As I said in at the beginning of my last reply, I don’t know what it will
> take to get FB to accept these definitions from js.swc.  I understand it
> will make it easier for you and others to contribute once we get FB
> working on these projects, but I would much prefer not to have to take the
> time to figure it out for the core_js_to_as branch until we are mostly
> done with the back port and have restructured the folders to a more final
> topology.  Otherwise, I think I will have to keep stopping to tweak the
> projects as we go and the whole thing will take longer.  Do you really
> have to have code hinting to get started on this XML library?  Or maybe
> just start coding it in a temporary package for now.  You can probably add
> some glue code to the output to map that class to the global scope.
> 
> The COMPILE::JS flag only controls what code the compiler has to compile,
> not what definitions it is pulling in from various SWCs.
> 
> From the command-line with Ant, I just tried building the Core project by
> switching to frameworks/projects/Core and then:
> 1) ran “ant -Dis.jenkins=true all” which proved it could build cleanly but
> skipped the tests
> 2) Edited Application.as and inside a COMPILE::JS block added:
>    var foo:DOMParser = null;
>    var bar:Document = null;
> 3) ran “ant -Dis.jenkins=true all” again to see if would compile.
> 
> It was missing DOMParser which I just added and pushed to flex-falcon so
> sync up and at least run “ant extern.swcs” there.  Then step 3 worked for
> me.
> 
> Please first try the Ant steps so at least we know that works for you.
> 
> -Alex
> 
>> 
>> On Nov 10, 2015, at 9:40 PM, Alex Harui <ah...@adobe.com> wrote:
>> 
>>>> I’m not sure you answered my primary question here. How do I target
>>>> HTML/JS native classes like Document, DOMParser, etc. in ActionScript?
>>>> I
>>>> don’t want to do that in js. I’d rather have FlaconJX cross-compile it
>>>> for me.
>>> 
>>> Not sure about what FlashBuilder will let you do, but from Ant, you
>>> should
>>> be able to use Document, DOMParser etc inside COMPILE::JS blocks.  Try
>>> adding test code to a class in the Core project and compile it.  Then
>>> we’ll worry about FlashBuilder.  It should work for Core because the
>>> compile-asjs phase will not use playerglobal/airglobal, it will use
>>> js.swc
>>> from the Falcon repo which has Document and DOMParser in it.
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 11/10/15, 1:50 PM, "Harbs" <ha...@gmail.com> wrote:

>I just tried in Core as well. If I set “-define=COMPILE::JS,true” which
>is what I believe we need to get code recognition and completion, I get
>lots of errors in FB.
>
>Am I going about this wrong?

As I said in at the beginning of my last reply, I don’t know what it will
take to get FB to accept these definitions from js.swc.  I understand it
will make it easier for you and others to contribute once we get FB
working on these projects, but I would much prefer not to have to take the
time to figure it out for the core_js_to_as branch until we are mostly
done with the back port and have restructured the folders to a more final
topology.  Otherwise, I think I will have to keep stopping to tweak the
projects as we go and the whole thing will take longer.  Do you really
have to have code hinting to get started on this XML library?  Or maybe
just start coding it in a temporary package for now.  You can probably add
some glue code to the output to map that class to the global scope.

The COMPILE::JS flag only controls what code the compiler has to compile,
not what definitions it is pulling in from various SWCs.

From the command-line with Ant, I just tried building the Core project by
switching to frameworks/projects/Core and then:
1) ran “ant -Dis.jenkins=true all” which proved it could build cleanly but
skipped the tests
2) Edited Application.as and inside a COMPILE::JS block added:
    var foo:DOMParser = null;
    var bar:Document = null;
3) ran “ant -Dis.jenkins=true all” again to see if would compile.

It was missing DOMParser which I just added and pushed to flex-falcon so
sync up and at least run “ant extern.swcs” there.  Then step 3 worked for
me.

Please first try the Ant steps so at least we know that works for you.

-Alex

>
>On Nov 10, 2015, at 9:40 PM, Alex Harui <ah...@adobe.com> wrote:
>
>>> I’m not sure you answered my primary question here. How do I target
>>> HTML/JS native classes like Document, DOMParser, etc. in ActionScript?
>>>I
>>> don’t want to do that in js. I’d rather have FlaconJX cross-compile it
>>> for me.
>> 
>> Not sure about what FlashBuilder will let you do, but from Ant, you
>>should
>> be able to use Document, DOMParser etc inside COMPILE::JS blocks.  Try
>> adding test code to a class in the Core project and compile it.  Then
>> we’ll worry about FlashBuilder.  It should work for Core because the
>> compile-asjs phase will not use playerglobal/airglobal, it will use
>>js.swc
>> from the Falcon repo which has Document and DOMParser in it.
>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
I just tried in Core as well. If I set “-define=COMPILE::JS,true” which is what I believe we need to get code recognition and completion, I get lots of errors in FB.

Am I going about this wrong?

On Nov 10, 2015, at 9:40 PM, Alex Harui <ah...@adobe.com> wrote:

>> I’m not sure you answered my primary question here. How do I target
>> HTML/JS native classes like Document, DOMParser, etc. in ActionScript? I
>> don’t want to do that in js. I’d rather have FlaconJX cross-compile it
>> for me.
> 
> Not sure about what FlashBuilder will let you do, but from Ant, you should
> be able to use Document, DOMParser etc inside COMPILE::JS blocks.  Try
> adding test code to a class in the Core project and compile it.  Then
> we’ll worry about FlashBuilder.  It should work for Core because the
> compile-asjs phase will not use playerglobal/airglobal, it will use js.swc
> from the Falcon repo which has Document and DOMParser in it.


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

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

On 11/10/15, 11:16 AM, "Harbs" <ha...@gmail.com> wrote:

>I’m not sure you answered my primary question here. How do I target
>HTML/JS native classes like Document, DOMParser, etc. in ActionScript? I
>don’t want to do that in js. I’d rather have FlaconJX cross-compile it
>for me.

Not sure about what FlashBuilder will let you do, but from Ant, you should
be able to use Document, DOMParser etc inside COMPILE::JS blocks.  Try
adding test code to a class in the Core project and compile it.  Then
we’ll worry about FlashBuilder.  It should work for Core because the
compile-asjs phase will not use playerglobal/airglobal, it will use js.swc
from the Falcon repo which has Document and DOMParser in it.


>
>Regarding decoding and encoding XML: Yes. That might be a good way to go.
>I’ll look at the Encoder and Decoder classes to see what they’re doing.
>How does it handle attributes and properties that might have the same
>names? Does each object have children and attributes, or does it take a
>simple structure approach? Same for namespaces, instructions and comments.

AIUI, attributes and properties with the same names is the key feature
that XML has over JSON.  The question is: how many folks actually have
this scenario?  Because if you don’t, the performance benefits may be
significant.  I’m not sure how the decoders handled that if at all.  I
would expect at minimum you could provide some sort of mapping that is
lighter weight than a full-blown XML schema.

Another reason to stay with XML is supposedly when you have
“mixed-content” where you need namespaces to avoid collisions between node
names.  I’m interested to know how many folks are truly in this situation.

>
>One way to handle the XML problem might be a 2-pronged approach: 1.
>Create XML/XMLList classes for js which would be able to process the
>basic E4X. 2. Have some classes which converts XML to objects and back.
>One disadvantage of *simple* objects is the difficulty of accessing
>pieces of the structure. Unless you know the exact structure of your data
>ahead of time, it’s very hard to get specific pieces of data without a
>lot of utility functions. That’s why even if we do go the object
>hierarchy approach (JSONy  but not exactly JSON), I think the objects
>should have the functionality built in to filter content, get
>children/descendants, etc.

I’m sure there are scenarios where going away from XML just won’t make
sense, so I would never say that we would never support XML in FlexJS.  I
have seen a few places execute the switch from XML to JSON as the means of
exchanging data with the client without any hassle because their data
structures are straightforward enough that they don’t lose anything by
going with JSON, so I’m wanting to make sure folks really need the power
of XML in the client.

Also, I’ve seen Flex apps that did use SOAPEncoder/SOAPDecoder to convert
SOAP/XML to Flex data objects and back.  At least one of them was able to
manually port only a few files so that they could convert JSON to those
same Flex data objects and back in a days work.  Their business logic did
not use E4x at all because they got better runtime performance by doing
the decoding/encoding.  But everyone’s mileage may vary.


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
I’m not sure you answered my primary question here. How do I target HTML/JS native classes like Document, DOMParser, etc. in ActionScript? I don’t want to do that in js. I’d rather have FlaconJX cross-compile it for me.

Regarding decoding and encoding XML: Yes. That might be a good way to go. I’ll look at the Encoder and Decoder classes to see what they’re doing. How does it handle attributes and properties that might have the same names? Does each object have children and attributes, or does it take a simple structure approach? Same for namespaces, instructions and comments.

One way to handle the XML problem might be a 2-pronged approach: 1. Create XML/XMLList classes for js which would be able to process the basic E4X. 2. Have some classes which converts XML to objects and back. One disadvantage of *simple* objects is the difficulty of accessing pieces of the structure. Unless you know the exact structure of your data ahead of time, it’s very hard to get specific pieces of data without a lot of utility functions. That’s why even if we do go the object hierarchy approach (JSONy  but not exactly JSON), I think the objects should have the functionality built in to filter content, get children/descendants, etc.


On Nov 10, 2015, at 4:18 PM, Alex Harui <ah...@adobe.com> wrote:

> The key is in the build.xml and compile-asjs-config.xml in any of the
> already-backported SWCs.  The js.swc from Falcon is used instead of
> playerglobal.swc/airglobal.swc.  I have not tried to swap out a class in
> the default package yet, but it should be doable.  We might need a
> compiler change if there are assumptions.  And I have no idea if FB is
> making any assumptions.
> 
> I forgot to add to that wiki page how to deal with platform-only
> components.  I will add that this morning, but basically, you should add
> them to the as/src/XXXClasses.as and put COMPILE::JS or COMPILE::AS3
> around it.  There are examples, especially in the Core.swc and HTML.swc.
> 
> FWIW, I don’t know why you can’t go from XML to JSON and back to XML.
> Both are hierarchical data structures.  In the Flex SDK we have
> SOAPDecoder and SOAPEncoder that take XML to data objects and back, and
> generally that performs better if you are going to access a significant
> percentage of the data.
> 
> HTH,
> -Alex
> 
> On 11/10/15, 3:45 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> I’m a bit stumped here. We have externs for HTML and native javascript
>> APIs. Right? How do I import these externs so these classes are
>> recognized when using COMPILE::JS?
>> 
>> Actually, I just searched for DOMParser and createHTMLDocument. Neither
>> searched turned anything up in FlexJS. So I’m wondering if I was wrong
>> about having externs for this.
>> 
>> On Nov 10, 2015, at 10:48 AM, Harbs <ha...@gmail.com> wrote:
>> 
>>> I’m going to have to do some fancy footwork to get this working. Flash
>>> Builder is complaining that palyerglobal.swc already exists whe I try to
>>> create an XML class in the default package.
>>> 
>>> Any ideas on how to do this?
>>> 
>>> On Nov 10, 2015, at 9:39 AM, Harbs <ha...@gmail.com> wrote:
>>> 
>>>> OK. This approach is different than the approach I started on, but it
>>>> could be workable.
>>>> 
>>>> I was going down the road where there would be a set of single new
>>>> classes which would proxy to XML and Document in Flash and HTML
>>>> respectively. You are suggesting we stick with XML and XMLList for
>>>> Flash and create new JS versions with the same public API as XML and
>>>> XMLList.
>>>> 
>>>> Where would you go about creating those JS classes? Would I just out
>>>> it in an “as” folder and wrap the whole class in a COMPILE::JS? Also,
>>>> what package would this go into? I’m assuming none, since XML and
>>>> XMLList are both top level classes.
>>>> 
>>>> BTW, I need to read and write XML files, so yeah, converting to JSON
>>>> is not an option.
>>>> 
>>>> On Nov 10, 2015, at 1:28 AM, Alex Harui <ah...@adobe.com> wrote:
>>>> 
>>>>> Renaming the thread
>>>>> 
>>>>> On 11/9/15, 1:12 PM, "Harbs" <ha...@gmail.com> wrote:
>>>>> 
>>>>>> Well, I’d be interested in your findings.
>>>>>> 
>>>>>> If operator definitions is possible .. will be easier than .
>>>>>> operators.
>>>>>> If we allow single dot operators, it will be difficult to
>>>>>> differentiate
>>>>>> between E4X syntax and function calls. I’d really like to drop the
>>>>>> () on
>>>>>> length and some of the other methods… Those are a course for very
>>>>>> common
>>>>>> errors.
>>>>> 
>>>>> Maybe we aren’t talking about the same thing, but let me explain in
>>>>> more
>>>>> detail what I’m saying.
>>>>> 
>>>>> Here is some E4x:
>>>>> 
>>>>> var a:XML = new XML(\"<top attr1='cat'><child attr2='dog'><grandchild
>>>>> attr3='fish'>text</grandchild></child></top>\”);
>>>>> var b:XMLList = a..child;
>>>>> var c:XMLList = a..grandchild.(@attr2 == 'fish');
>>>>> 
>>>>> 
>>>>> (It would be nice to have others add in their favorite or common
>>>>> scenarios
>>>>> if they are different).
>>>>> 
>>>>> The compiler already understands the “..” as well as the “@“.  The way
>>>>> Falcon and FalconJX works is that there is a parsing phase that takes
>>>>> your
>>>>> source code and creates a tree of different kinds of nodes
>>>>> (ClassNodes,
>>>>> FunctionNodes, FunctionCallNodes, OperatorNodes,
>>>>> MemberAccessExpressionNodes, etc).  Falcon then walks the tree and
>>>>> converts these nodes to ABC.  FalconJX walks the tree and outputs
>>>>> JavaScript.
>>>>> 
>>>>> I just ran a test and the above code was parsed into a tree where the
>>>>> “..”
>>>>> was the operator for a MemberAccessExpression. The “@“ was converted
>>>>> into
>>>>> a unary operator for an E4xFilter operator for another
>>>>> MemberAccessExpression.  This is good for FalconJX, because that
>>>>> means we
>>>>> understand the semantics of this syntax and can then generate any
>>>>> JavaScript we want.
>>>>> 
>>>>> IMO, given that folks are already wishing for a more Spark and MX-like
>>>>> component set, I think we should try to mimic as much of E4x as
>>>>> possible
>>>>> as opposed to inventing a new API that folks would have to migrate to.
>>>>> Performance-wise, I still think it would be worth everyone’s time to
>>>>> convert XML to JSON, but there are probably folks who can’t move.
>>>>> 
>>>>> Given that FlexJS leverages the concept of replacing abstractions, if
>>>>> you
>>>>> create an XML and XMLList class in JavaScript and populate them with
>>>>> the
>>>>> same APIs as ActionScript, lots of things should work.  The FalconJX
>>>>> compiler could easily be taught to convert “a..child” into
>>>>> “a.descendants()”.  If the JS version has an extra filter() function,
>>>>> then
>>>>> FalconJX would convert
>>>>> 
>>>>> a..grandchild.(@attr2 == 'fish’)
>>>>> 
>>>>> into 
>>>>> 
>>>>> a.descendants().filter(function (node) { return
>>>>> node.attribute(‘fish’).length() })
>>>>> 
>>>>> or something like that.
>>>>> 
>>>>> I think the part of XML in ActionScript that isn’t practical to do in
>>>>> JavaScript is handling change notifications.  It might be possible to
>>>>> do
>>>>> some of it for known properties but I think it would be fragile.
>>>>> 
>>>>> For example:
>>>>> 
>>>>> var d:XML = a..child[0];
>>>>> d.foo = <bar />;
>>>>> 
>>>>> In ActionScript you can get a change notification when foo is
>>>>> assigned.
>>>>> With a bunch of work, if we know you are setting “foo” (which we do
>>>>> know
>>>>> in this case) I think we could use Object.defineProperty to define a
>>>>> property on d.
>>>>> 
>>>>> What we can’t easily do is:
>>>>> 
>>>>> var d:XML = a..child[0];
>>>>> var s:String = “someRandomPropertyName”;
>>>>> d[s] = <bar />;
>>>>> 
>>>>> If we don’t know what ’s’ is, we can’t define properties early on the
>>>>> XML
>>>>> node.  I suppose with even more code we could generate code for that.
>>>>> 
>>>>> BTW, for any sort of solution, we would have to know that “d” is XML
>>>>> and
>>>>> not Object and that would require more careful type handling in the
>>>>> code
>>>>> our customers write.  If you have:
>>>>> 
>>>>> 
>>>>> public class MyClass extends EventDispatcher
>>>>> {
>>>>> public var someProp:XML;
>>>>> }
>>>>> 
>>>>> Then in some other class you have:
>>>>> 
>>>>> var instance:MyClass = new MyClass();
>>>>> instance.addEventListener(“someEvent”, myHandler);
>>>>> 
>>>>> function myHandler(event:Event):void
>>>>> {
>>>>> event.target.someProp.foo = <newnode />;
>>>>> }
>>>>> 
>>>>> We have lost the notion that someProp is XML and not Object because
>>>>> event.target is defined as Object and not MyClass.  Folks will have
>>>>> to fix
>>>>> up their code to be:
>>>>> 
>>>>> (event.target as MyClass).someProp.foo = <newnode />;
>>>>> 
>>>>> Which won’t be much fun and if you miss one, you won’t get a compile
>>>>> error.
>>>>> 
>>>>> FWIW, we could probably put in a warning if you forget () on “length”,
>>>>> again if we know that length is being access on an XML node and not
>>>>> Object.
>>>>> 
>>>>> HTH,
>>>>> -Alex
>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Alex Harui <ah...@adobe.com>.
The key is in the build.xml and compile-asjs-config.xml in any of the
already-backported SWCs.  The js.swc from Falcon is used instead of
playerglobal.swc/airglobal.swc.  I have not tried to swap out a class in
the default package yet, but it should be doable.  We might need a
compiler change if there are assumptions.  And I have no idea if FB is
making any assumptions.

I forgot to add to that wiki page how to deal with platform-only
components.  I will add that this morning, but basically, you should add
them to the as/src/XXXClasses.as and put COMPILE::JS or COMPILE::AS3
around it.  There are examples, especially in the Core.swc and HTML.swc.

FWIW, I don’t know why you can’t go from XML to JSON and back to XML.
Both are hierarchical data structures.  In the Flex SDK we have
SOAPDecoder and SOAPEncoder that take XML to data objects and back, and
generally that performs better if you are going to access a significant
percentage of the data.

HTH,
-Alex

On 11/10/15, 3:45 AM, "Harbs" <ha...@gmail.com> wrote:

>I’m a bit stumped here. We have externs for HTML and native javascript
>APIs. Right? How do I import these externs so these classes are
>recognized when using COMPILE::JS?
>
>Actually, I just searched for DOMParser and createHTMLDocument. Neither
>searched turned anything up in FlexJS. So I’m wondering if I was wrong
>about having externs for this.
>
>On Nov 10, 2015, at 10:48 AM, Harbs <ha...@gmail.com> wrote:
>
>> I’m going to have to do some fancy footwork to get this working. Flash
>>Builder is complaining that palyerglobal.swc already exists whe I try to
>>create an XML class in the default package.
>> 
>> Any ideas on how to do this?
>> 
>> On Nov 10, 2015, at 9:39 AM, Harbs <ha...@gmail.com> wrote:
>> 
>>> OK. This approach is different than the approach I started on, but it
>>>could be workable.
>>> 
>>> I was going down the road where there would be a set of single new
>>>classes which would proxy to XML and Document in Flash and HTML
>>>respectively. You are suggesting we stick with XML and XMLList for
>>>Flash and create new JS versions with the same public API as XML and
>>>XMLList.
>>> 
>>> Where would you go about creating those JS classes? Would I just out
>>>it in an “as” folder and wrap the whole class in a COMPILE::JS? Also,
>>>what package would this go into? I’m assuming none, since XML and
>>>XMLList are both top level classes.
>>> 
>>> BTW, I need to read and write XML files, so yeah, converting to JSON
>>>is not an option.
>>> 
>>> On Nov 10, 2015, at 1:28 AM, Alex Harui <ah...@adobe.com> wrote:
>>> 
>>>> Renaming the thread
>>>> 
>>>> On 11/9/15, 1:12 PM, "Harbs" <ha...@gmail.com> wrote:
>>>> 
>>>>> Well, I’d be interested in your findings.
>>>>> 
>>>>> If operator definitions is possible .. will be easier than .
>>>>>operators.
>>>>> If we allow single dot operators, it will be difficult to
>>>>>differentiate
>>>>> between E4X syntax and function calls. I’d really like to drop the
>>>>>() on
>>>>> length and some of the other methods… Those are a course for very
>>>>>common
>>>>> errors.
>>>> 
>>>> Maybe we aren’t talking about the same thing, but let me explain in
>>>>more
>>>> detail what I’m saying.
>>>> 
>>>> Here is some E4x:
>>>> 
>>>> var a:XML = new XML(\"<top attr1='cat'><child attr2='dog'><grandchild
>>>> attr3='fish'>text</grandchild></child></top>\”);
>>>> var b:XMLList = a..child;
>>>> var c:XMLList = a..grandchild.(@attr2 == 'fish');
>>>> 
>>>> 
>>>> (It would be nice to have others add in their favorite or common
>>>>scenarios
>>>> if they are different).
>>>> 
>>>> The compiler already understands the “..” as well as the “@“.  The way
>>>> Falcon and FalconJX works is that there is a parsing phase that takes
>>>>your
>>>> source code and creates a tree of different kinds of nodes
>>>>(ClassNodes,
>>>> FunctionNodes, FunctionCallNodes, OperatorNodes,
>>>> MemberAccessExpressionNodes, etc).  Falcon then walks the tree and
>>>> converts these nodes to ABC.  FalconJX walks the tree and outputs
>>>> JavaScript.
>>>> 
>>>> I just ran a test and the above code was parsed into a tree where the
>>>>“..”
>>>> was the operator for a MemberAccessExpression. The “@“ was converted
>>>>into
>>>> a unary operator for an E4xFilter operator for another
>>>> MemberAccessExpression.  This is good for FalconJX, because that
>>>>means we
>>>> understand the semantics of this syntax and can then generate any
>>>> JavaScript we want.
>>>> 
>>>> IMO, given that folks are already wishing for a more Spark and MX-like
>>>> component set, I think we should try to mimic as much of E4x as
>>>>possible
>>>> as opposed to inventing a new API that folks would have to migrate to.
>>>> Performance-wise, I still think it would be worth everyone’s time to
>>>> convert XML to JSON, but there are probably folks who can’t move.
>>>> 
>>>> Given that FlexJS leverages the concept of replacing abstractions, if
>>>>you
>>>> create an XML and XMLList class in JavaScript and populate them with
>>>>the
>>>> same APIs as ActionScript, lots of things should work.  The FalconJX
>>>> compiler could easily be taught to convert “a..child” into
>>>> “a.descendants()”.  If the JS version has an extra filter() function,
>>>>then
>>>> FalconJX would convert
>>>> 
>>>> a..grandchild.(@attr2 == 'fish’)
>>>> 
>>>> into 
>>>> 
>>>> a.descendants().filter(function (node) { return
>>>> node.attribute(‘fish’).length() })
>>>> 
>>>> or something like that.
>>>> 
>>>> I think the part of XML in ActionScript that isn’t practical to do in
>>>> JavaScript is handling change notifications.  It might be possible to
>>>>do
>>>> some of it for known properties but I think it would be fragile.
>>>> 
>>>> For example:
>>>> 
>>>> var d:XML = a..child[0];
>>>> d.foo = <bar />;
>>>> 
>>>> In ActionScript you can get a change notification when foo is
>>>>assigned.
>>>> With a bunch of work, if we know you are setting “foo” (which we do
>>>>know
>>>> in this case) I think we could use Object.defineProperty to define a
>>>> property on d.
>>>> 
>>>> What we can’t easily do is:
>>>> 
>>>> var d:XML = a..child[0];
>>>> var s:String = “someRandomPropertyName”;
>>>> d[s] = <bar />;
>>>> 
>>>> If we don’t know what ’s’ is, we can’t define properties early on the
>>>>XML
>>>> node.  I suppose with even more code we could generate code for that.
>>>> 
>>>> BTW, for any sort of solution, we would have to know that “d” is XML
>>>>and
>>>> not Object and that would require more careful type handling in the
>>>>code
>>>> our customers write.  If you have:
>>>> 
>>>> 
>>>> public class MyClass extends EventDispatcher
>>>> {
>>>>  public var someProp:XML;
>>>> }
>>>> 
>>>> Then in some other class you have:
>>>> 
>>>> var instance:MyClass = new MyClass();
>>>> instance.addEventListener(“someEvent”, myHandler);
>>>> 
>>>> function myHandler(event:Event):void
>>>> {
>>>>  event.target.someProp.foo = <newnode />;
>>>> }
>>>> 
>>>> We have lost the notion that someProp is XML and not Object because
>>>> event.target is defined as Object and not MyClass.  Folks will have
>>>>to fix
>>>> up their code to be:
>>>> 
>>>>  (event.target as MyClass).someProp.foo = <newnode />;
>>>> 
>>>> Which won’t be much fun and if you miss one, you won’t get a compile
>>>>error.
>>>> 
>>>> FWIW, we could probably put in a warning if you forget () on “length”,
>>>> again if we know that length is being access on an XML node and not
>>>>Object.
>>>> 
>>>> HTH,
>>>> -Alex
>>>> 
>>>> 
>>> 
>> 
>


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
I’m a bit stumped here. We have externs for HTML and native javascript APIs. Right? How do I import these externs so these classes are recognized when using COMPILE::JS?

Actually, I just searched for DOMParser and createHTMLDocument. Neither searched turned anything up in FlexJS. So I’m wondering if I was wrong about having externs for this.

On Nov 10, 2015, at 10:48 AM, Harbs <ha...@gmail.com> wrote:

> I’m going to have to do some fancy footwork to get this working. Flash Builder is complaining that palyerglobal.swc already exists whe I try to create an XML class in the default package.
> 
> Any ideas on how to do this?
> 
> On Nov 10, 2015, at 9:39 AM, Harbs <ha...@gmail.com> wrote:
> 
>> OK. This approach is different than the approach I started on, but it could be workable.
>> 
>> I was going down the road where there would be a set of single new classes which would proxy to XML and Document in Flash and HTML respectively. You are suggesting we stick with XML and XMLList for Flash and create new JS versions with the same public API as XML and XMLList.
>> 
>> Where would you go about creating those JS classes? Would I just out it in an “as” folder and wrap the whole class in a COMPILE::JS? Also, what package would this go into? I’m assuming none, since XML and XMLList are both top level classes.
>> 
>> BTW, I need to read and write XML files, so yeah, converting to JSON is not an option.
>> 
>> On Nov 10, 2015, at 1:28 AM, Alex Harui <ah...@adobe.com> wrote:
>> 
>>> Renaming the thread
>>> 
>>> On 11/9/15, 1:12 PM, "Harbs" <ha...@gmail.com> wrote:
>>> 
>>>> Well, I’d be interested in your findings.
>>>> 
>>>> If operator definitions is possible .. will be easier than . operators.
>>>> If we allow single dot operators, it will be difficult to differentiate
>>>> between E4X syntax and function calls. I’d really like to drop the () on
>>>> length and some of the other methods… Those are a course for very common
>>>> errors.
>>> 
>>> Maybe we aren’t talking about the same thing, but let me explain in more
>>> detail what I’m saying.
>>> 
>>> Here is some E4x:
>>> 
>>> var a:XML = new XML(\"<top attr1='cat'><child attr2='dog'><grandchild
>>> attr3='fish'>text</grandchild></child></top>\”);
>>> var b:XMLList = a..child;
>>> var c:XMLList = a..grandchild.(@attr2 == 'fish');
>>> 
>>> 
>>> (It would be nice to have others add in their favorite or common scenarios
>>> if they are different).
>>> 
>>> The compiler already understands the “..” as well as the “@“.  The way
>>> Falcon and FalconJX works is that there is a parsing phase that takes your
>>> source code and creates a tree of different kinds of nodes (ClassNodes,
>>> FunctionNodes, FunctionCallNodes, OperatorNodes,
>>> MemberAccessExpressionNodes, etc).  Falcon then walks the tree and
>>> converts these nodes to ABC.  FalconJX walks the tree and outputs
>>> JavaScript.
>>> 
>>> I just ran a test and the above code was parsed into a tree where the “..”
>>> was the operator for a MemberAccessExpression. The “@“ was converted into
>>> a unary operator for an E4xFilter operator for another
>>> MemberAccessExpression.  This is good for FalconJX, because that means we
>>> understand the semantics of this syntax and can then generate any
>>> JavaScript we want.
>>> 
>>> IMO, given that folks are already wishing for a more Spark and MX-like
>>> component set, I think we should try to mimic as much of E4x as possible
>>> as opposed to inventing a new API that folks would have to migrate to.
>>> Performance-wise, I still think it would be worth everyone’s time to
>>> convert XML to JSON, but there are probably folks who can’t move.
>>> 
>>> Given that FlexJS leverages the concept of replacing abstractions, if you
>>> create an XML and XMLList class in JavaScript and populate them with the
>>> same APIs as ActionScript, lots of things should work.  The FalconJX
>>> compiler could easily be taught to convert “a..child” into
>>> “a.descendants()”.  If the JS version has an extra filter() function, then
>>> FalconJX would convert
>>> 
>>> a..grandchild.(@attr2 == 'fish’)
>>> 
>>> into 
>>> 
>>> a.descendants().filter(function (node) { return
>>> node.attribute(‘fish’).length() })
>>> 
>>> or something like that.
>>> 
>>> I think the part of XML in ActionScript that isn’t practical to do in
>>> JavaScript is handling change notifications.  It might be possible to do
>>> some of it for known properties but I think it would be fragile.
>>> 
>>> For example:
>>> 
>>> var d:XML = a..child[0];
>>> d.foo = <bar />;
>>> 
>>> In ActionScript you can get a change notification when foo is assigned.
>>> With a bunch of work, if we know you are setting “foo” (which we do know
>>> in this case) I think we could use Object.defineProperty to define a
>>> property on d.
>>> 
>>> What we can’t easily do is:
>>> 
>>> var d:XML = a..child[0];
>>> var s:String = “someRandomPropertyName”;
>>> d[s] = <bar />;
>>> 
>>> If we don’t know what ’s’ is, we can’t define properties early on the XML
>>> node.  I suppose with even more code we could generate code for that.
>>> 
>>> BTW, for any sort of solution, we would have to know that “d” is XML and
>>> not Object and that would require more careful type handling in the code
>>> our customers write.  If you have:
>>> 
>>> 
>>> public class MyClass extends EventDispatcher
>>> {
>>>  public var someProp:XML;
>>> }
>>> 
>>> Then in some other class you have:
>>> 
>>> var instance:MyClass = new MyClass();
>>> instance.addEventListener(“someEvent”, myHandler);
>>> 
>>> function myHandler(event:Event):void
>>> {
>>>  event.target.someProp.foo = <newnode />;
>>> }
>>> 
>>> We have lost the notion that someProp is XML and not Object because
>>> event.target is defined as Object and not MyClass.  Folks will have to fix
>>> up their code to be:
>>> 
>>>  (event.target as MyClass).someProp.foo = <newnode />;
>>> 
>>> Which won’t be much fun and if you miss one, you won’t get a compile error.
>>> 
>>> FWIW, we could probably put in a warning if you forget () on “length”,
>>> again if we know that length is being access on an XML node and not Object.
>>> 
>>> HTH,
>>> -Alex
>>> 
>>> 
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
I’m going to have to do some fancy footwork to get this working. Flash Builder is complaining that palyerglobal.swc already exists whe I try to create an XML class in the default package.

Any ideas on how to do this?

On Nov 10, 2015, at 9:39 AM, Harbs <ha...@gmail.com> wrote:

> OK. This approach is different than the approach I started on, but it could be workable.
> 
> I was going down the road where there would be a set of single new classes which would proxy to XML and Document in Flash and HTML respectively. You are suggesting we stick with XML and XMLList for Flash and create new JS versions with the same public API as XML and XMLList.
> 
> Where would you go about creating those JS classes? Would I just out it in an “as” folder and wrap the whole class in a COMPILE::JS? Also, what package would this go into? I’m assuming none, since XML and XMLList are both top level classes.
> 
> BTW, I need to read and write XML files, so yeah, converting to JSON is not an option.
> 
> On Nov 10, 2015, at 1:28 AM, Alex Harui <ah...@adobe.com> wrote:
> 
>> Renaming the thread
>> 
>> On 11/9/15, 1:12 PM, "Harbs" <ha...@gmail.com> wrote:
>> 
>>> Well, I’d be interested in your findings.
>>> 
>>> If operator definitions is possible .. will be easier than . operators.
>>> If we allow single dot operators, it will be difficult to differentiate
>>> between E4X syntax and function calls. I’d really like to drop the () on
>>> length and some of the other methods… Those are a course for very common
>>> errors.
>> 
>> Maybe we aren’t talking about the same thing, but let me explain in more
>> detail what I’m saying.
>> 
>> Here is some E4x:
>> 
>> var a:XML = new XML(\"<top attr1='cat'><child attr2='dog'><grandchild
>> attr3='fish'>text</grandchild></child></top>\”);
>> var b:XMLList = a..child;
>> var c:XMLList = a..grandchild.(@attr2 == 'fish');
>> 
>> 
>> (It would be nice to have others add in their favorite or common scenarios
>> if they are different).
>> 
>> The compiler already understands the “..” as well as the “@“.  The way
>> Falcon and FalconJX works is that there is a parsing phase that takes your
>> source code and creates a tree of different kinds of nodes (ClassNodes,
>> FunctionNodes, FunctionCallNodes, OperatorNodes,
>> MemberAccessExpressionNodes, etc).  Falcon then walks the tree and
>> converts these nodes to ABC.  FalconJX walks the tree and outputs
>> JavaScript.
>> 
>> I just ran a test and the above code was parsed into a tree where the “..”
>> was the operator for a MemberAccessExpression. The “@“ was converted into
>> a unary operator for an E4xFilter operator for another
>> MemberAccessExpression.  This is good for FalconJX, because that means we
>> understand the semantics of this syntax and can then generate any
>> JavaScript we want.
>> 
>> IMO, given that folks are already wishing for a more Spark and MX-like
>> component set, I think we should try to mimic as much of E4x as possible
>> as opposed to inventing a new API that folks would have to migrate to.
>> Performance-wise, I still think it would be worth everyone’s time to
>> convert XML to JSON, but there are probably folks who can’t move.
>> 
>> Given that FlexJS leverages the concept of replacing abstractions, if you
>> create an XML and XMLList class in JavaScript and populate them with the
>> same APIs as ActionScript, lots of things should work.  The FalconJX
>> compiler could easily be taught to convert “a..child” into
>> “a.descendants()”.  If the JS version has an extra filter() function, then
>> FalconJX would convert
>> 
>> a..grandchild.(@attr2 == 'fish’)
>> 
>> into 
>> 
>> a.descendants().filter(function (node) { return
>> node.attribute(‘fish’).length() })
>> 
>> or something like that.
>> 
>> I think the part of XML in ActionScript that isn’t practical to do in
>> JavaScript is handling change notifications.  It might be possible to do
>> some of it for known properties but I think it would be fragile.
>> 
>> For example:
>> 
>> var d:XML = a..child[0];
>> d.foo = <bar />;
>> 
>> In ActionScript you can get a change notification when foo is assigned.
>> With a bunch of work, if we know you are setting “foo” (which we do know
>> in this case) I think we could use Object.defineProperty to define a
>> property on d.
>> 
>> What we can’t easily do is:
>> 
>> var d:XML = a..child[0];
>> var s:String = “someRandomPropertyName”;
>> d[s] = <bar />;
>> 
>> If we don’t know what ’s’ is, we can’t define properties early on the XML
>> node.  I suppose with even more code we could generate code for that.
>> 
>> BTW, for any sort of solution, we would have to know that “d” is XML and
>> not Object and that would require more careful type handling in the code
>> our customers write.  If you have:
>> 
>> 
>> public class MyClass extends EventDispatcher
>> {
>>   public var someProp:XML;
>> }
>> 
>> Then in some other class you have:
>> 
>> var instance:MyClass = new MyClass();
>> instance.addEventListener(“someEvent”, myHandler);
>> 
>> function myHandler(event:Event):void
>> {
>>   event.target.someProp.foo = <newnode />;
>> }
>> 
>> We have lost the notion that someProp is XML and not Object because
>> event.target is defined as Object and not MyClass.  Folks will have to fix
>> up their code to be:
>> 
>>   (event.target as MyClass).someProp.foo = <newnode />;
>> 
>> Which won’t be much fun and if you miss one, you won’t get a compile error.
>> 
>> FWIW, we could probably put in a warning if you forget () on “length”,
>> again if we know that length is being access on an XML node and not Object.
>> 
>> HTH,
>> -Alex
>> 
>> 
> 


Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)

Posted by Harbs <ha...@gmail.com>.
OK. This approach is different than the approach I started on, but it could be workable.

I was going down the road where there would be a set of single new classes which would proxy to XML and Document in Flash and HTML respectively. You are suggesting we stick with XML and XMLList for Flash and create new JS versions with the same public API as XML and XMLList.

Where would you go about creating those JS classes? Would I just out it in an “as” folder and wrap the whole class in a COMPILE::JS? Also, what package would this go into? I’m assuming none, since XML and XMLList are both top level classes.

BTW, I need to read and write XML files, so yeah, converting to JSON is not an option.

On Nov 10, 2015, at 1:28 AM, Alex Harui <ah...@adobe.com> wrote:

> Renaming the thread
> 
> On 11/9/15, 1:12 PM, "Harbs" <ha...@gmail.com> wrote:
> 
>> Well, I’d be interested in your findings.
>> 
>> If operator definitions is possible .. will be easier than . operators.
>> If we allow single dot operators, it will be difficult to differentiate
>> between E4X syntax and function calls. I’d really like to drop the () on
>> length and some of the other methods… Those are a course for very common
>> errors.
> 
> Maybe we aren’t talking about the same thing, but let me explain in more
> detail what I’m saying.
> 
> Here is some E4x:
> 
>  var a:XML = new XML(\"<top attr1='cat'><child attr2='dog'><grandchild
> attr3='fish'>text</grandchild></child></top>\”);
>  var b:XMLList = a..child;
>  var c:XMLList = a..grandchild.(@attr2 == 'fish');
> 
> 
> (It would be nice to have others add in their favorite or common scenarios
> if they are different).
> 
> The compiler already understands the “..” as well as the “@“.  The way
> Falcon and FalconJX works is that there is a parsing phase that takes your
> source code and creates a tree of different kinds of nodes (ClassNodes,
> FunctionNodes, FunctionCallNodes, OperatorNodes,
> MemberAccessExpressionNodes, etc).  Falcon then walks the tree and
> converts these nodes to ABC.  FalconJX walks the tree and outputs
> JavaScript.
> 
> I just ran a test and the above code was parsed into a tree where the “..”
> was the operator for a MemberAccessExpression. The “@“ was converted into
> a unary operator for an E4xFilter operator for another
> MemberAccessExpression.  This is good for FalconJX, because that means we
> understand the semantics of this syntax and can then generate any
> JavaScript we want.
> 
> IMO, given that folks are already wishing for a more Spark and MX-like
> component set, I think we should try to mimic as much of E4x as possible
> as opposed to inventing a new API that folks would have to migrate to.
> Performance-wise, I still think it would be worth everyone’s time to
> convert XML to JSON, but there are probably folks who can’t move.
> 
> Given that FlexJS leverages the concept of replacing abstractions, if you
> create an XML and XMLList class in JavaScript and populate them with the
> same APIs as ActionScript, lots of things should work.  The FalconJX
> compiler could easily be taught to convert “a..child” into
> “a.descendants()”.  If the JS version has an extra filter() function, then
> FalconJX would convert
> 
> a..grandchild.(@attr2 == 'fish’)
> 
> into 
> 
> a.descendants().filter(function (node) { return
> node.attribute(‘fish’).length() })
> 
> or something like that.
> 
> I think the part of XML in ActionScript that isn’t practical to do in
> JavaScript is handling change notifications.  It might be possible to do
> some of it for known properties but I think it would be fragile.
> 
> For example:
> 
> var d:XML = a..child[0];
> d.foo = <bar />;
> 
> In ActionScript you can get a change notification when foo is assigned.
> With a bunch of work, if we know you are setting “foo” (which we do know
> in this case) I think we could use Object.defineProperty to define a
> property on d.
> 
> What we can’t easily do is:
> 
> var d:XML = a..child[0];
> var s:String = “someRandomPropertyName”;
> d[s] = <bar />;
> 
> If we don’t know what ’s’ is, we can’t define properties early on the XML
> node.  I suppose with even more code we could generate code for that.
> 
> BTW, for any sort of solution, we would have to know that “d” is XML and
> not Object and that would require more careful type handling in the code
> our customers write.  If you have:
> 
> 
> public class MyClass extends EventDispatcher
> {
>    public var someProp:XML;
> }
> 
> Then in some other class you have:
> 
> var instance:MyClass = new MyClass();
> instance.addEventListener(“someEvent”, myHandler);
> 
> function myHandler(event:Event):void
> {
>    event.target.someProp.foo = <newnode />;
> }
> 
> We have lost the notion that someProp is XML and not Object because
> event.target is defined as Object and not MyClass.  Folks will have to fix
> up their code to be:
> 
>    (event.target as MyClass).someProp.foo = <newnode />;
> 
> Which won’t be much fun and if you miss one, you won’t get a compile error.
> 
> FWIW, we could probably put in a warning if you forget () on “length”,
> again if we know that length is being access on an XML node and not Object.
> 
> HTH,
> -Alex
> 
>