On 2/10/16, 3:23 AM, "Harbs" <harbs.li...@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 <aha...@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.
>

Reply via email to