On 5/8/16, 1:18 AM, "Harbs" <harbs.li...@gmail.com> wrote:

>I’m still having trouble with the spec, though. The spec has the
>following in [[Append]]:
>
>3. If Type(V) is XMLList,
>  a. Let x.[[TargetObject]] = V.[[TargetObject]]
>  b. Let x.[[TargetProperty]] = V.[[TargetProperty]]
>  c. Let n = V.[[Length]]
>  d. If n == 0, Return
>  e. For j = 0 to V.[[Length]]-1, let x[i + j] = V[j]
>
>Step e uses bracket assignment to the XMList of the values in the
>right-hand object. As I understand it, bracket assignment inserts the
>object into the target object as well. I think that’s what it says in
>[[Put]], but I’m not sure. Of course, with my understanding, a and b
>should be after step e. So, I’m somewhat confused there...

Can you be more specific about what text makes you think the bracket
assignment inserts into the targetObject?  I'd say that other parts of the
spec are more explicit about calling [[Put]] and other methods and that
bracket syntax is just assigning values to the internal object for XML and
XMLList.

>
>Either way, I think we need to add a plus() method to XML and XMLList
>which does “the right thing” as described by 11.4.1 in the spec.
>
>I’m also not sure every case of addition is being handled correctly:
>
>1. Number + XML/XMLList
>2. XML/XMLList + Number
>3. String + XML/XMLList
>4. XML/XMLList + String
>5. XML/XMLList + XML/XMLList

Well, concat() is currently what is output.  It might be only used where
you would want to use plus().

But I had a not-so-nice thought:  Maybe we need to rewrite our XML
implementation.  I am feeling like we made a mistake making up our own
method names thinking that we understood the 'semantics' of E4x.  It might
be that we need to have you implement [[Put]] [[Append]], etc. and have
the compiler generate the algorithms described in the spec.

This would void your suggestion for adding a foreach() method.  Our
current codegen expects the return of an object to iterate which is what
the E4x spec says to do.

This would be a significant amount of work, but might be for the best.

Thoughts?
-Alex

Reply via email to