Extending WAModelProxy to handle the proxying of methods with 2 or more arguments..

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

Extending WAModelProxy to handle the proxying of methods with 2 or more arguments..

Martin J. Laubach-2
|  Anyone care to steer me in the right direction such that this method
|  can handle methods that look something like :
|
|  MyClass>>UpdateMyArrayAt: myIndex with: myValue

  The short answer: It can't. The proxy is a really simple minded thing
that just assumes: a selector with one argument is a setter and sets
an instance variable, and there is a corresponding getter (same selector
without arg). Thus it intercepts #foo: and #foo and simulates setting
and getting.

  Quite obviously this won't work right for more elaborate getter/setter
scenarios that do more, like "insert stuff in a Collection".

  In that case you'd probably need to make a deep copy and build a proxy
that keeps a log of all actions so it can replay them against the original
on commit.

        mjl
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Extending WAModelProxy to handle the proxying of methods with 2 or more arguments..

Rick Flower
Martin J. Laubach wrote:

> |  Anyone care to steer me in the right direction such that this method
> |  can handle methods that look something like :
> |
> |  MyClass>>UpdateMyArrayAt: myIndex with: myValue
>
>   The short answer: It can't. The proxy is a really simple minded thing
> that just assumes: a selector with one argument is a setter and sets
> an instance variable, and there is a corresponding getter (same selector
> without arg). Thus it intercepts #foo: and #foo and simulates setting
> and getting.

After studying the code further yesterday, I ended up refactoring the
code a bit to get a collection as a single argument and it in fact
solved this problem, so I guess I don't really need to solve this
particular issue as it looked a bit ugly to solve.. (8->

Thanks!

-- Rick
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside