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

Fredrik Rothamel fredrik.rothamel at bahnhof.se
Thu Feb 3 08:27:29 UTC 2011


Jonathan Leto skrev 2011-02-02 17:33:
> Howdy,
>
> Can you show us an example output of what strange behavior you are
> seeing? A small chunk of code that exhibits what you are seeing would
> be useful.

The unexpected behaviour comes from me trying to extend Squaak without 
fully understanding PIR or the PMC-objects involved. My bad, I will RTFM.
The basic pirops generated by the compiler behaves as designed. (As far 
as I can tell...)
Pmichaud created an excellent example describing the comparison op 
behaviour.

> Which version of Parrot?

3.0.0 from git on cygwin.

>
> Duke
>
> On Wed, Feb 2, 2011 at 3:10 AM, Fredrik Rothamel
> <fredrik.rothamel at bahnhof.se>  wrote:
>> 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
>> _______________________________________________
>> Parrot-users mailing list
>> Parrot-users at lists.parrot.org
>> http://lists.parrot.org/mailman/listinfo/parrot-users
>>
>
>
>



More information about the Parrot-users mailing list