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

Reply via email to