Hi Benjamin. Yes, this is a known "problem". Check http://forum.world.st/problem-with-CompiledMethod-equality-tt2221276.html#a2221276
2010/9/9 Eliot Miranda <[email protected]> > > > 2010/9/9 Benjamin Van Ryseghem <[email protected]> > > Hi everybody, >> >> >> I wonder if it's normal than two different methods can have the same >> CompiledMethod ? >> >> By example : >> >> Class >> foo >> 'foo' >> >> and >> >> Class >> foo2 >> 'foo' >> >> If I evaluate (Class methodDict at: #foo) = (Class methodDict at: #foo2), >> it answers true. >> >> Maybe the CompiledMethod >> = should test the source ? >> > > There are many definitions of method equality. If you ant to test the > source you can test the source, (C >> #foo) getSourceFromFile asString = (C > >> #foo2) getSourceFromFile asString. You can test the decompilation of a > method (C>>#foo) decompileString = (C>>#foo2) decompileString. > > The current definition tests whether the bytecodes and literals are the > same, not the selector or the source code. That's a useful definition, but > not the only one. It is close to the decompile version but faster, and is > useful in e.g. testing whether the compiler has changed, since if on > recompiling a method is still = the compiler is producing the same bytecode > for a compilation. That's what I use it for and it's an important use. > > cheers > Eliot > > >> >> >> Ben >> >> _______________________________________________ >> Pharo-project mailing list >> [email protected] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> > > > _______________________________________________ > Pharo-project mailing list > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >
_______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
