Strange happenings in Pharo ...

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

Strange happenings in Pharo ...

stepken
Hi!

This stuff, cleaning up unused Code fails in Pharo, but runs
successfully in Squeak 3.10.

(Association allInstances select:
        [:x | ((x value isKindOf: Behavior) and: ['AnOb*' match: x value name]) or:
        ['AnOb*' match: x value class name]])
        collect: [:x | x key -> x value allInstances size]

Same stuff, changed a bit to "AnObj*", runs. Why?

(Association allInstances select:
        [:x | ((x value isKindOf: Behavior) and: ['AnObj*' match: x value
name]) or:
        ['AnObj*' match: x value class name]])
        collect: [:x | x key -> x value allInstances size]

regards, Guido Stepken


_______________________________________________
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: Strange happenings in Pharo ...

Nicolas Cellier
2009/4/24 stepken <[hidden email]>:

> Hi!
>
> This stuff, cleaning up unused Code fails in Pharo, but runs
> successfully in Squeak 3.10.
>
> (Association allInstances select:
>        [:x | ((x value isKindOf: Behavior) and: ['AnOb*' match: x value name]) or:
>        ['AnOb*' match: x value class name]])
>        collect: [:x | x key -> x value allInstances size]
>

This code is broken. Try to guess why.
Clues:
- browse all implementors of #allInstances.
- observe class of x value in the debugger
- observe the or: clause to explain why a non Behavior could pass the
select: phase

> Same stuff, changed a bit to "AnObj*", runs. Why?

There is no match.
This question sounds like "If I change a bit in my program, results
are not the same why ?"

Cheers

>
> (Association allInstances select:
>        [:x | ((x value isKindOf: Behavior) and: ['AnObj*' match: x value
> name]) or:
>        ['AnObj*' match: x value class name]])
>        collect: [:x | x key -> x value allInstances size]
>
> regards, Guido Stepken
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

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