Back when we were making some improvements to Java Integration's Java
array support, a bunch of additional coercions were added. Most of
these are tested by test/testJavaArraySupport.rb.

Put simply, for many/most core Ruby types, there are several ways to
get them to fit into a target Java type. For a target type of
java.lang.Boolean, for example, booleans and nil obviously fit, but
Fixnums also fit (== 0 or not), Strings fit (Boolean.valueOf(string)),
and objects that implement to_i fit in the same way that Fixnums fit.
For other target types, there are similar checks and implicit
coercions.

I'm thinking of removing most of these. An array of Fixnums is not an
array of Booleans, and I don't think it's a valid implicit coercion to
allow it to become one. The same argument goes for Strings converting
to numerics or Booleans converting to numbers. The conversion is
unexpected, in my opinion, and also makes the logic for inserting
elements into an array much more complicated.

My question: Is anyone using these implicit coercions of array
elements? So far the only place I've found failures (when I just use
"simple" coercion) is in this test script...

- Charlie

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to