Equality of Recursive Structures [Was: Closure Compiler in 3.9 ?]

Philippe Marschall philippe.marschall at gmail.com
Thu May 10 19:17:31 UTC 2007


2007/5/10, Lukas Renggli <renggli at gmail.com>:
> > The only solution i see it may be to add into VM a stack check for
> > detecting repetitive patterns.
>
> That doesn't make sense.
>
> As a programmer one should know what recursion is. One should also
> know what it means to have circular references. Comparing two objects
> using #= doesn't make much sense, unless you know exactly what the #=
> is doing. Unfortunately every class in Squeak implements it with a
> different philosophy and even worse (a = b) = (b = a) is sometimes
> even false.
>
> The Squeak collections try to be super smart with the #=, but
> obviously they are not smart enough for the given examples.
> VisualWorks doesn't implement #= in Collection and therefore uses #==.
> In my opinion this makes a lot of sense.

This is annoying for comparing collections and results in some ugly
code in WAFileLibraryTest.

Cheers
Philippe

> Collections are such a
> generic container that they cannot be compared as is for all possible
> uses. I found myself implementing special comparison operators many
> times already.
>
> This is exactly the same as for copying (as discussed a few months
> ago). Sometimes you want ...
>
> - an equality comparison #==
> - a shallow comparison
> - a deep comparison
> - a very deep comparison (following the terms in the copy protocol)
> - sometimes you want to ignore certain values
> - sometimes you want to stop a certain places or after a certain time
> - etc.
>
> There is simply not a single solution that works for all.
>
> Cheers,
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
>
>



More information about the Squeak-dev mailing list