String #to_l vs Ruby Console in SU 2022 (thought)

I’m just thinking out loud, maybe it will be a bit useful for some others…

String #to_l instance_method
“The to_l method is used to convert a string to a length. The returned length is expressed in the Model units.

I’ve been thinking a bit: What a …?

Until it occurred to me that:

Release Notes: Made Ruby Console output more consistent
…A side effect of this is that the console now uses .inspect instead of .puts when printing the returned value which makes it less ambiguous in many cases…

I thought I’d say that maybe a word could be corrected in Release Notes…
many >> most :innocent:

1 Like

I think we have an open API issue for this as the “returns” phrase has always been untrue.

The returned length from String#to_l is a Length object which is in inches.

Prior to SU2022 the Console output would display (a string) in model units because it would call the Length object’s #to_s method. (This caused someone writing the API docs years ago, to erroneously believe that many methods returned values “in model units” when it was just the console coercing the object into printable text via it’s #to_s method. There are or were quite a few places in docs where this “in model units” needs to be removed.)

This would require someone to make a count of all the places that this ambiguity did or could happen and the count of those fixed, and then determine the percentage that meets the “most” criteria (for those reading the docs.) Using “many” avoids wasting time on this that is better spent on other issues.

My feeling of what percentage means “most” might be different than yours. (I think 2/3 or 66% but in other cases it can be less depending upon context.)

Look at the information linked below and you’ll see that changing “many” to “most” will make the current sentence ambiguous (without more context.)

1 Like