Fwd: [squeak-dev] bug in OBMetagraphBuilder>>#reference

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

Fwd: [squeak-dev] bug in OBMetagraphBuilder>>#reference

Mariano Martinez Peck
lukas?

---------- Forwarded message ----------
From: Chris Muller <[hidden email]>
Date: Mon, Oct 25, 2010 at 6:16 PM
Subject: [squeak-dev] bug in OBMetagraphBuilder>>#reference
To: squeak dev <[hidden email]>


Hi, I just wanted to let the maintainers of OmniBrowser know, there is
a bug with this method.

The method reflects on its class and performs all that begin with
#populate.  However, it is not unusual to expect that someone's
application might have a selector that also begins with the word
'populate'.  And so those selectors would be performed as well.

This is why, for cases like this, it is better for a tool, which is
just a means, not an end, to be polite with the namespace; such as
checking for 'obPopulate' perhaps rather than simply 'populate'.

But that's just a mini-rant, not even the bug.  The bug is, my
'populate' is not a unary message, so I get a failure on the perform,
"incorrect number of arguments."

I therefore always change the method to:

OBMetagraphBuilder >> execute
       ((self class allSelectors select: [:ea | (ea beginsWith: 'populate')
and: [ ea isUnary ]]) asSortedArray)
               do: [:selector | self perform: selector].
       ^ self root

Thank you,
 Chris



_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: [squeak-dev] bug in OBMetagraphBuilder>>#reference

Lukas Renggli
This was fixed in April 2010 to use pragmas, looks like the original
poster uses an old version.

2010/10/25 Mariano Martinez Peck <[hidden email]>:

> lukas?
>
> ---------- Forwarded message ----------
> From: Chris Muller <[hidden email]>
> Date: Mon, Oct 25, 2010 at 6:16 PM
> Subject: [squeak-dev] bug in OBMetagraphBuilder>>#reference
> To: squeak dev <[hidden email]>
>
>
> Hi, I just wanted to let the maintainers of OmniBrowser know, there is
> a bug with this method.
>
> The method reflects on its class and performs all that begin with
> #populate.  However, it is not unusual to expect that someone's
> application might have a selector that also begins with the word
> 'populate'.  And so those selectors would be performed as well.
>
> This is why, for cases like this, it is better for a tool, which is
> just a means, not an end, to be polite with the namespace; such as
> checking for 'obPopulate' perhaps rather than simply 'populate'.
>
> But that's just a mini-rant, not even the bug.  The bug is, my
> 'populate' is not a unary message, so I get a failure on the perform,
> "incorrect number of arguments."
>
> I therefore always change the method to:
>
> OBMetagraphBuilder >> execute
>        ((self class allSelectors select: [:ea | (ea beginsWith: 'populate')
> and: [ ea isUnary ]]) asSortedArray)
>                do: [:selector | self perform: selector].
>        ^ self root
>
> Thank you,
>  Chris
>
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project