[Parrot-users] Numerical and string comparisons in Squaak (and PIR)

Fredrik Rothamel fredrik.rothamel at bahnhof.se
Wed Feb 2 11:10:30 UTC 2011


Hi,

While tinkering with Squaak and debugging some strange behaviour I 
noticed that I get different results from the comparison ops depending 
on the order of parameters with different types.
How do I make sure a numerical comparison is performed if at least one 
parameter is a number?

"<" for example is implemented using pirop "islt PMC, PMC"

How do I make "islt" use the string PMCs cmp_num method instead of the 
default cmp when the first parameter is a string and the second 
parameter is an integer?
Do I need to inherit and modify the string PMC or are there other ways?

BR,
Fredrik


More information about the Parrot-users mailing list