Bug or feature? XMLElement>>allElementsDo:

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug or feature? XMLElement>>allElementsDo:

Nicolas Anquetil
In XML-Parser-Nodes we have:

XMLNodeWithElements
  XMLDocument
  XMLElement

A document is composed of elements that can hold recursively other elements

XMLNodeWithElements implements (in protocol enumerating)
allElementsDo: aBlock
    "Descend depth-first visiting each element with aBlock."

    self hasElements
        ifTrue: [self elementsDo: [:each | each allElementsDo: aBlock]]

Looks perfectly normal to me
But then:

XMLElement implements (in protocol searching !)
allElementsDo: aBlock
    "See superclass version."

    aBlock value: self.

    super allElementsDo: aBlock.

which means that
  anXMLElement allElementsDo: [...]
runs first on itself and then on its elements ?!?
Seems counter intuitive to me.

Should I remove this?

nicolas

nicolas

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Bug or feature? XMLElement>>allElementsDo:

abergel
You may want to discuss this issue on the Pharo mailing list.

Cheers,
Alexandre


On 29 Aug 2011, at 10:12, Nicolas Anquetil wrote:

> In XML-Parser-Nodes we have:
>
> XMLNodeWithElements
>   XMLDocument
>   XMLElement
>
> A document is composed of elements that can hold recursively other elements
>
> XMLNodeWithElements implements (in protocol enumerating)
> allElementsDo: aBlock
>     "Descend depth-first visiting each element with aBlock."
>
>     self hasElements
>         ifTrue: [self elementsDo: [:each | each allElementsDo: aBlock]]
>
> Looks perfectly normal to me
> But then:
>
> XMLElement implements (in protocol searching !)
> allElementsDo: aBlock
>     "See superclass version."
>
>     aBlock value: self.
>
>     super allElementsDo: aBlock.
>
> which means that
>   anXMLElement allElementsDo: [...]
> runs first on itself and then on its elements ?!?
> Seems counter intuitive to me.
>
> Should I remove this?
>
> nicolas
>
> nicolas
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.





_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev