[vwnc] Glorp proxy equality bug.

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

[vwnc] Glorp proxy equality bug.

Steve Aldred-3
Using the Glorp that comes with VW7.6..

If you try to compare two proxies the answer will always be false.

This is because in AbstractProxy we have

= anObject
    "In VA we inherit this as identity. Need to override"
    ^self getValue = anObject.


when it should be reversed to force resolution of anObject when it is
also a proxy:

= anObject
    "Comparison order reversed in order to ensure that comparing two
proxies works"
    ^anObject = self getValue


Attached is a package with the fix and also #~= which needs to do the
same thing for the same reason.

cheers
Steve A

<?xml version="1.0"?>

<st-source>
<time-stamp>From VisualWorks® NonCommercial, 7.6 of March 3, 2008 on October 23, 2008 at 11:25:34 am</time-stamp>
<!-- Package GlorpProxyEqualityFix(1.0,steve)= -->



<methods>
<class-id>Glorp.AbstractProxy</class-id> <category>accessing</category>

<body package="GlorpProxyEqualityFix" selector="=">= anObject
        "Comparison order reversed in order to ensure that comparing two proxies works"
        ^anObject = self getValue</body>

<body package="GlorpProxyEqualityFix" selector="~=">~= anObject
        "Comparison order reversed in order to ensure that comparing two proxies works"
        ^anObject ~= self getValue</body>
</methods>



</st-source>

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Glorp proxy equality bug.

Alan Knight-2
Well, it will be false if the objects in question don't define any equality, and fall back to identity. Still, it seems reasonable enough.

~= I think ought to be implementable just as
   (self = anObject) not
the way it could be defined for anything, it's just not supplied by proxy normally.

Created AR 55542 for it.

At 08:33 PM 10/22/2008, Steve Aldred wrote:
Using the Glorp that comes with VW7.6..

If you try to compare two proxies the answer will always be false.

This is because in AbstractProxy we have

= anObject
   "In VA we inherit this as identity. Need to override"
   ^self getValue = anObject.


when it should be reversed to force resolution of anObject when it is also a proxy:

= anObject
   "Comparison order reversed in order to ensure that comparing two proxies works"
   ^anObject = self getValue


Attached is a package with the fix and also #~= which needs to do the same thing for the same reason.

cheers
Steve A


<?xml version="1.0"?>

<st-source>
<time-stamp>From VisualWorks® NonCommercial, 7.6 of March 3, 2008 on October 23, 2008 at 11:25:34 am</time-stamp>
<!-- Package GlorpProxyEqualityFix(1.0,steve)= -->



<methods>
<class-id>Glorp.AbstractProxy</class-id> <category>accessing</category>

<body package="GlorpProxyEqualityFix" selector="=">= anObject
         "Comparison order reversed in order to ensure that comparing two proxies works"
        ^anObject = self getValue</body>

<body package="GlorpProxyEqualityFix" selector="~=">~= anObject
         "Comparison order reversed in order to ensure that comparing two proxies works"
        ^anObject ~= self getValue</body>
</methods>



</st-source>

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

--
Alan Knight [|], Engineering Manager, Cincom Smalltalk

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Glorp proxy equality bug.

Michael Lucas-Smith-2
In reply to this post by Steve Aldred-3
Cheers Steve,

This has been addressed differently in newer versions of Glorp,
available in public store.

Cheers,
Michael

Steve Aldred wrote:

> Using the Glorp that comes with VW7.6..
>
> If you try to compare two proxies the answer will always be false.
>
> This is because in AbstractProxy we have
>
> = anObject
>    "In VA we inherit this as identity. Need to override"
>    ^self getValue = anObject.
>
>
> when it should be reversed to force resolution of anObject when it is
> also a proxy:
>
> = anObject
>    "Comparison order reversed in order to ensure that comparing two
> proxies works"
>    ^anObject = self getValue
>
>
> Attached is a package with the fix and also #~= which needs to do the
> same thing for the same reason.
>
> cheers
> Steve A
> ------------------------------------------------------------------------
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc