irb >> puts [1,2]+3
TypeError: can't convert Fixnum into Array
from (irb):1:in `+'
To quote #9:
This is caused by the leftover Perlisms from when a lot of the originating code was taken from Rakudo. Namely: implicit conversion. Ruby doesn't do it by default. So in order to fix this, here are the steps that'll be taken:
Go through and add the implicit (to_str, to_int, etc.) and explicit (to_s, to_i, etc.) methods for all the stdlib classes that declare them. Then add stuff into Object so that anything that doesn't have an explicit implicit conversion method won't convert implicitly. This'll probably break a lot of things, but it'll at least let us know where things depend on implicit conversion. Then we go through and fix those.
#9 is now waitiing on this.
Been working on this today. Got a bunch of it done.
One problem I encountered which I don't quite understand is that removing the get_string vtable from NilClass causes cardinal.pir to not be able to instantiate a CardinalArray, because it can't find it. Might just have to live with this in until someone can figure out why that happens.
Another problem is that parrot;Integer declares a to_int method, whereas cardinal;Integer absolutely cannot have a to_int.
Not sure what to do about this. One might consider replacing to_int with a method that just throws an Exception, but that's still a little screwy in the case of "Hey, object, do you have a to_int method?" "Yes, yes, I do." "Sweet, I can treat you like an int." Then blammo.
So, yeah, this is a problem.
Parrot has opcodes for adding methods, but none for removing them.
My work so far is on the iss32 branch.