On 11/15/15, 7:55 AM, "Harbs" <harbs.li...@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 <aha...@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++.
>

Reply via email to