I have a strange effect I was not able to find out so far. You can try with
any newer Pharo image/VM but here are the exact combination I tried: 1. Load latest VM from https://dl.bintray.com/pharo-project/pharo-vm/ which is as of today (https://dl.bintray.com/pharo-project/pharo-vm/pharo-win-i386-201701091105-b0400d4.zip) Extract in a directory. 2. Download and extract http://files.pharo.org/sources/PharoV50.sources.zip into same directory 3. Use latest image http://files.pharo.org/image/60/60342.zip in same directory 4. Start Pharo and load "Pastell" Metacello new smalltalkhubUser: 'Pharo' project: 'MetaRepoForPharo50'; configuration: 'Pastell'; version: #stable; load. 5. Put some Transcript output into: XMLNodeWithElements>>#doesNotUnderstand: by changing it to: doesNotUnderstand: aMessage "If I have one or more childs whose name is the same as the selector, return them in a PastellCollection. Otherwise, let the DNU propagate" | v | Transcript show: aMessage selector asString;cr. v := self child: aMessage selector. ^ v ifEmpty: [ super doesNotUnderstand: aMessage ] ifNotEmpty: [ v ]. 6. Now evaluate: | xml document htmls html heads | Transcript open;clear. xml := '<html> <head></head> <head></head> </html>'. document := XMLDOMParser parse: xml readStream. htmls := document html. "gives a pastell collection using the #doesNotUnderstand: trick" html := htmls first. "first element from collection, the class is XMLElement, a subclass of XMLNodeWithElements" html head "should call #doesNotUnderstand: again in XMLNodeWithElements but it is not" As you see the #html message triggers the #doesNotUnderstand: while #head does not. For strange reasons the XMLNodeWithElements>>#doesNotUnderstand: is only called once and then not anymore. Did I miss something? Last time Pastell worked was in Pharo 3.0. Is this a Cog issue or something I do not see? It seems to work on Mac (according to Stephan Eggermont). Any idea? Thanks T. |
I've found it:
Loading Pastell into latest image 60342 using: Metacello new smalltalkhubUser: 'Pharo' project: 'MetaRepoForPharo50'; configuration: 'Pastell'; version: #stable; load. the tests are green now. And it is also not a difference between Mac and Windows When the method looks like testDNU | xml document html testElements | xml := '<html><testElement/><testElement/></html>'. document := XMLDOMParser parse: xml readStream. html := document html. testElements := html testElement. self assert: testElements size = 2. self assert: testElements first name = #testElement. self assert: testElements last name = #testElement it works When I exchange the tag "testElement" agains "head" it does not work as I reported in my last mail: testDNU | xml document html testElements | xml := '<html><head/><head/></html>'. document := XMLDOMParser parse: xml readStream. html := document html. testElements := html head. self assert: testElements size = 2. self assert: testElements first name = #head. self assert: testElements last name = #head Now the assertions fail although only the tag name/message changed. Reason is simple: there is a #head method in Object from Morphic just returning self. For whatever reason but this makes the difference. Lesson learned: take care with DNU tricks ;) Sorry for the noise! Bye T. |
> On 11 Jan 2017, at 09:33, Torsten Bergmann <[hidden email]> wrote: > > I've found it: > > Loading Pastell into latest image 60342 using: > > > Metacello new > smalltalkhubUser: 'Pharo' project: 'MetaRepoForPharo50'; > configuration: 'Pastell'; > version: #stable; > load. > > the tests are green now. > > And it is also not a difference between Mac and Windows > > > When the method looks like > > testDNU > | xml document html testElements | > xml := '<html><testElement/><testElement/></html>'. > document := XMLDOMParser parse: xml readStream. > html := document html. > testElements := html testElement. > self assert: testElements size = 2. > self assert: testElements first name = #testElement. > self assert: testElements last name = #testElement > > it works > > > When I exchange the tag "testElement" agains "head" it does not work as I reported > in my last mail: > > testDNU > | xml document html testElements | > xml := '<html><head/><head/></html>'. > document := XMLDOMParser parse: xml readStream. > html := document html. > testElements := html head. > self assert: testElements size = 2. > self assert: testElements first name = #head. > self assert: testElements last name = #head > > Now the assertions fail although only the tag name/message changed. > > Reason is simple: there is a #head method in Object from Morphic just returning > self. For whatever reason but this makes the difference. > > Lesson learned: take care with DNU tricks ;) > > Sorry for the noise! That's not noise, it is an interesting lesson ! But why the hell would there be a Object>>#head ?! IMHO such general selectors at this level should not be used unless there is a very good reason to do so. > Bye > T. > > |
> But why the hell would there be a Object>>#head ?!
> > IMHO such general selectors at this level should not be used unless there is a very good reason to do so. > Yes - some Morphic addition. Version says: BenjaminVanRyseghem in 2013 Only used in MorphTreeNodeMorph and to me this smells. We should nuke it. Thx T. |
> On 11 Jan 2017, at 09:55, Torsten Bergmann <[hidden email]> wrote: > >> But why the hell would there be a Object>>#head ?! >> >> IMHO such general selectors at this level should not be used unless there is a very good reason to do so. >> > > Yes - some Morphic addition. Version says: BenjaminVanRyseghem in 2013 > Only used in MorphTreeNodeMorph and to me this smells. We should nuke it. > > Thx > T. Looking in a 6 image, there is also an even uglier implementation in Association>>#head ^ (key isKindOf: Association) ifTrue: [ key head ] ifFalse: [ key ] Duh. And I can't seen any senders... |
at least we should rename it as “treeMorphHead”… just “head” is too generic.
Esteban > On 11 Jan 2017, at 10:03, Sven Van Caekenberghe <[hidden email]> wrote: > > >> On 11 Jan 2017, at 09:55, Torsten Bergmann <[hidden email]> wrote: >> >>> But why the hell would there be a Object>>#head ?! >>> >>> IMHO such general selectors at this level should not be used unless there is a very good reason to do so. >>> >> >> Yes - some Morphic addition. Version says: BenjaminVanRyseghem in 2013 >> Only used in MorphTreeNodeMorph and to me this smells. We should nuke it. >> >> Thx >> T. > > Looking in a 6 image, there is also an even uglier implementation in > > Association>>#head > > ^ (key isKindOf: Association) > ifTrue: [ key head ] > ifFalse: [ key ] > > Duh. > > And I can't seen any senders... > > |
> On 11 Jan 2017, at 10:12, Esteban Lorenzano <[hidden email]> wrote: > > at least we should rename it as “treeMorphHead”… just “head” is too generic. “treeNodeHead” I meant. > > Esteban > > >> On 11 Jan 2017, at 10:03, Sven Van Caekenberghe <[hidden email]> wrote: >> >> >>> On 11 Jan 2017, at 09:55, Torsten Bergmann <[hidden email]> wrote: >>> >>>> But why the hell would there be a Object>>#head ?! >>>> >>>> IMHO such general selectors at this level should not be used unless there is a very good reason to do so. >>>> >>> >>> Yes - some Morphic addition. Version says: BenjaminVanRyseghem in 2013 >>> Only used in MorphTreeNodeMorph and to me this smells. We should nuke it. >>> >>> Thx >>> T. >> >> Looking in a 6 image, there is also an even uglier implementation in >> >> Association>>#head >> >> ^ (key isKindOf: Association) >> ifTrue: [ key head ] >> ifFalse: [ key ] >> >> Duh. >> >> And I can't seen any senders... >> >> > |
And Object/Association >> #tail
Best regards, Henrik -----Opprinnelig melding----- Fra: Pharo-dev [mailto:[hidden email]] På vegne av Esteban Lorenzano Sendt: 11 January 2017 10:13 Til: Pharo Development List <[hidden email]> Emne: Re: [Pharo-dev] Strange DNU effect on Windows with Pastell > On 11 Jan 2017, at 10:12, Esteban Lorenzano <[hidden email]> wrote: > > at least we should rename it as “treeMorphHead”… just “head” is too generic. “treeNodeHead” I meant. > > Esteban > > >> On 11 Jan 2017, at 10:03, Sven Van Caekenberghe <[hidden email]> wrote: >> >> >>> On 11 Jan 2017, at 09:55, Torsten Bergmann <[hidden email]> wrote: >>> >>>> But why the hell would there be a Object>>#head ?! >>>> >>>> IMHO such general selectors at this level should not be used unless there is a very good reason to do so. >>>> >>> >>> Yes - some Morphic addition. Version says: BenjaminVanRyseghem in >>> 2013 Only used in MorphTreeNodeMorph and to me this smells. We should nuke it. >>> >>> Thx >>> T. >> >> Looking in a 6 image, there is also an even uglier implementation in >> >> Association>>#head >> >> ^ (key isKindOf: Association) >> ifTrue: [ key head ] >> ifFalse: [ key ] >> >> Duh. >> >> And I can't seen any senders... >> >> > |
in general, rule of thumb when extending classes should be “use the most specific name possible”, for instance: #magritteDescription instead of #description, etc.
but everybody makes mistakes… in voyage I added methods #save, #remove instead a #voyageSave, #voyageRemove… one could argue that since that is *not* part of the image is ok, but no: is a framework so possibility of collisions are always there (of course, when doing your own project methods is another things… and I’m sure I can find other exceptions… but as I said … “in general”) Esteban > On 11 Jan 2017, at 11:46, Henrik Nergaard <[hidden email]> wrote: > > And Object/Association >> #tail > > Best regards, > Henrik > > -----Opprinnelig melding----- > Fra: Pharo-dev [mailto:[hidden email]] På vegne av Esteban Lorenzano > Sendt: 11 January 2017 10:13 > Til: Pharo Development List <[hidden email]> > Emne: Re: [Pharo-dev] Strange DNU effect on Windows with Pastell > > >> On 11 Jan 2017, at 10:12, Esteban Lorenzano <[hidden email]> wrote: >> >> at least we should rename it as “treeMorphHead”… just “head” is too generic. > > “treeNodeHead” I meant. > >> >> Esteban >> >> >>> On 11 Jan 2017, at 10:03, Sven Van Caekenberghe <[hidden email]> wrote: >>> >>> >>>> On 11 Jan 2017, at 09:55, Torsten Bergmann <[hidden email]> wrote: >>>> >>>>> But why the hell would there be a Object>>#head ?! >>>>> >>>>> IMHO such general selectors at this level should not be used unless there is a very good reason to do so. >>>>> >>>> >>>> Yes - some Morphic addition. Version says: BenjaminVanRyseghem in >>>> 2013 Only used in MorphTreeNodeMorph and to me this smells. We should nuke it. >>>> >>>> Thx >>>> T. >>> >>> Looking in a 6 image, there is also an even uglier implementation in >>> >>> Association>>#head >>> >>> ^ (key isKindOf: Association) >>> ifTrue: [ key head ] >>> ifFalse: [ key ] >>> >>> Duh. >>> >>> And I can't seen any senders... >>> >>> >> > > |
In reply to this post by Henrik-Nergaard
All good and well, but maybe its me, but I can't see where it is being used ...
> On 11 Jan 2017, at 11:46, Henrik Nergaard <[hidden email]> wrote: > > And Object/Association >> #tail > > Best regards, > Henrik > > -----Opprinnelig melding----- > Fra: Pharo-dev [mailto:[hidden email]] På vegne av Esteban Lorenzano > Sendt: 11 January 2017 10:13 > Til: Pharo Development List <[hidden email]> > Emne: Re: [Pharo-dev] Strange DNU effect on Windows with Pastell > > >> On 11 Jan 2017, at 10:12, Esteban Lorenzano <[hidden email]> wrote: >> >> at least we should rename it as “treeMorphHead”… just “head” is too generic. > > “treeNodeHead” I meant. > >> >> Esteban >> >> >>> On 11 Jan 2017, at 10:03, Sven Van Caekenberghe <[hidden email]> wrote: >>> >>> >>>> On 11 Jan 2017, at 09:55, Torsten Bergmann <[hidden email]> wrote: >>>> >>>>> But why the hell would there be a Object>>#head ?! >>>>> >>>>> IMHO such general selectors at this level should not be used unless there is a very good reason to do so. >>>>> >>>> >>>> Yes - some Morphic addition. Version says: BenjaminVanRyseghem in >>>> 2013 Only used in MorphTreeNodeMorph and to me this smells. We should nuke it. >>>> >>>> Thx >>>> T. >>> >>> Looking in a 6 image, there is also an even uglier implementation in >>> >>> Association>>#head >>> >>> ^ (key isKindOf: Association) >>> ifTrue: [ key head ] >>> ifFalse: [ key ] >>> >>> Duh. >>> >>> And I can't seen any senders... >>> >>> >> > > |
Both #head and #tail is used by MorphTreeNodeMorph (#expandPath: and #matchPath:) to select items deeper inside the tree structure and then expanding to this.
------------------------------------------------------------------------- | model morph | model := ClassTreeExample new. model openOn: Morph. model selectItems: { Morph -> BorderedMorph -> AlignmentMorph }. ------------------------------------------------------------------------- Changing one should not be done without the other. Best regards, Henrik -----Opprinnelig melding----- Fra: Pharo-dev [mailto:[hidden email]] På vegne av Sven Van Caekenberghe Sendt: 11 January 2017 11:56 Til: Pharo Development List <[hidden email]> Emne: Re: [Pharo-dev] Strange DNU effect on Windows with Pastell All good and well, but maybe its me, but I can't see where it is being used ... > On 11 Jan 2017, at 11:46, Henrik Nergaard <[hidden email]> wrote: > > And Object/Association >> #tail > > Best regards, > Henrik > > -----Opprinnelig melding----- > Fra: Pharo-dev [mailto:[hidden email]] På vegne av Esteban Lorenzano > Sendt: 11 January 2017 10:13 > Til: Pharo Development List <[hidden email]> > Emne: Re: [Pharo-dev] Strange DNU effect on Windows with Pastell > > >> On 11 Jan 2017, at 10:12, Esteban Lorenzano <[hidden email]> wrote: >> >> at least we should rename it as “treeMorphHead”… just “head” is too generic. > > “treeNodeHead” I meant. > >> >> Esteban >> >> >>> On 11 Jan 2017, at 10:03, Sven Van Caekenberghe <[hidden email]> wrote: >>> >>> >>>> On 11 Jan 2017, at 09:55, Torsten Bergmann <[hidden email]> wrote: >>>> >>>>> But why the hell would there be a Object>>#head ?! >>>>> >>>>> IMHO such general selectors at this level should not be used unless there is a very good reason to do so. >>>>> >>>> >>>> Yes - some Morphic addition. Version says: BenjaminVanRyseghem in >>>> 2013 Only used in MorphTreeNodeMorph and to me this smells. We should nuke it. >>>> >>>> Thx >>>> T. >>> >>> Looking in a 6 image, there is also an even uglier implementation in >>> >>> Association>>#head >>> >>> ^ (key isKindOf: Association) >>> ifTrue: [ key head ] >>> ifFalse: [ key ] >>> >>> Duh. >>> >>> And I can't seen any senders... >>> >>> >> > > |
OK, thanks, you are right; I was confused by the new filter option in senders, somehow I assumed the list was not longer (and I ignored the scroll bar) - weird. I see them now.
Yes, both should be changed together. > On 11 Jan 2017, at 12:33, Henrik Nergaard <[hidden email]> wrote: > > Both #head and #tail is used by MorphTreeNodeMorph (#expandPath: and #matchPath:) to select items deeper inside the tree structure and then expanding to this. > ------------------------------------------------------------------------- > | model morph | > model := ClassTreeExample new. > model openOn: Morph. > model selectItems: { Morph -> BorderedMorph -> AlignmentMorph }. > ------------------------------------------------------------------------- > > Changing one should not be done without the other. > > Best regards, > Henrik > > -----Opprinnelig melding----- > Fra: Pharo-dev [mailto:[hidden email]] På vegne av Sven Van Caekenberghe > Sendt: 11 January 2017 11:56 > Til: Pharo Development List <[hidden email]> > Emne: Re: [Pharo-dev] Strange DNU effect on Windows with Pastell > > All good and well, but maybe its me, but I can't see where it is being used ... > >> On 11 Jan 2017, at 11:46, Henrik Nergaard <[hidden email]> wrote: >> >> And Object/Association >> #tail >> >> Best regards, >> Henrik >> >> -----Opprinnelig melding----- >> Fra: Pharo-dev [mailto:[hidden email]] På vegne av Esteban Lorenzano >> Sendt: 11 January 2017 10:13 >> Til: Pharo Development List <[hidden email]> >> Emne: Re: [Pharo-dev] Strange DNU effect on Windows with Pastell >> >> >>> On 11 Jan 2017, at 10:12, Esteban Lorenzano <[hidden email]> wrote: >>> >>> at least we should rename it as “treeMorphHead”… just “head” is too generic. >> >> “treeNodeHead” I meant. >> >>> >>> Esteban >>> >>> >>>> On 11 Jan 2017, at 10:03, Sven Van Caekenberghe <[hidden email]> wrote: >>>> >>>> >>>>> On 11 Jan 2017, at 09:55, Torsten Bergmann <[hidden email]> wrote: >>>>> >>>>>> But why the hell would there be a Object>>#head ?! >>>>>> >>>>>> IMHO such general selectors at this level should not be used unless there is a very good reason to do so. >>>>>> >>>>> >>>>> Yes - some Morphic addition. Version says: BenjaminVanRyseghem in >>>>> 2013 Only used in MorphTreeNodeMorph and to me this smells. We should nuke it. >>>>> >>>>> Thx >>>>> T. >>>> >>>> Looking in a 6 image, there is also an even uglier implementation in >>>> >>>> Association>>#head >>>> >>>> ^ (key isKindOf: Association) >>>> ifTrue: [ key head ] >>>> ifFalse: [ key ] >>>> >>>> Duh. >>>> >>>> And I can't seen any senders... >>>> >>>> >>> >> >> > > |
In reply to this post by Torsten Bergmann
can you open a bug entry.
I'm dreaming about a Object with far less funky methods. On Wed, 11 Jan 2017 09:55:06 +0100, Torsten Bergmann <[hidden email]> wrote: >> But why the hell would there be a Object>>#head ?! >> >> IMHO such general selectors at this level should not be used unless >> there is a very good reason to do so. >> > > Yes - some Morphic addition. Version says: BenjaminVanRyseghem in 2013 > Only used in MorphTreeNodeMorph and to me this smells. We should nuke it. > > Thx > T. > -- Using Opera's mail client: http://www.opera.com/mail/ |
In reply to this post by Sven Van Caekenberghe-2
On Wed, 11 Jan 2017 12:48:43 +0100, Sven Van Caekenberghe <[hidden email]>
wrote: > OK, thanks, you are right; I was confused by the new filter option in > senders, somehow I assumed the list was not longer (and I ignored the > scroll bar) - weird./mail/ yes it happens to me a lot and it is annoying. |
Free forum by Nabble | Edit this page |