#perform:withArguments: not working with WeakArray

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

#perform:withArguments: not working with WeakArray

marcel.taeumel
Hey, there!

This does not work (i.e. primitive failed):

m := Morph new.
c := Color white.
m perform: #color: withArguments: (WeakArray with: c).

Is this primitive-fail okay? If yes, we have a bug in WeakMessageSend >> #collectArguments: because it will always return a WeakArray if the arg sizes does not match. Usually a normal array otherwise.

I observed this kind of bug when using our object events like this:

m1 := Morph new.
m2 := Morph new.

m1 when: #baz send: #color: to: m2 with: Color black.
m1 triggerEvent: #baz withArguments: {Color white. #blubb}. "fails due to weak array"
m1 triggerEvent: #baz withArguments: {Color white}. "works due to normal array"

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: #perform:withArguments: not working with WeakArray

Eliot Miranda-2
Hi Marcel,

> On Apr 28, 2016, at 7:10 AM, marcel.taeumel <[hidden email]> wrote:
>
> Hey, there!
>
> This does not work (i.e. primitive failed):
>
> m := Morph new.
> c := Color white.
> m perform: #color: withArguments: (WeakArray with: c).
>
> Is this primitive-fail okay?

Yes.  The primitive is specified to require an Array instance, not merely an indexable pointers object.

> If yes, we have a bug in WeakMessageSend >>
> #collectArguments: because it will always return a WeakArray if the arg
> sizes does not match. Usually a normal array otherwise.

That's the bug.

> I observed this kind of bug when using our object events like this:
>
> m1 := Morph new.
> m2 := Morph new.
>
> m1 when: #baz send: #color: to: m2 with: Color black.
> m1 triggerEvent: #baz withArguments: {Color white. #blubb}. "fails due to
> weak array"
> m1 triggerEvent: #baz withArguments: {Color white}. "works due to normal
> array"
>
> Best,
> Marcel


_,,,^..^,,,_ (phone)