HaloO Larry, you wrote:
Num-to-Int autocoercion is an explicit exception built into the language. Perl 5 programmars would lynch us if we broke it. But yes, it's basically cheating.
In your array subscript reply you conceded that flooring is better behaved than truncation. Which would mean that -4 === Int(-3.25) should be True. This is important if the right hand side is an auto-coerced parameter: sub foo (Int $x) { if $x === -4 { say "floored" } } foo(-3.25); sub distance (Int $from, Int $to) { return $to - $from } say distance(-3.3, 2.3); # should print 6 or perhaps 5.6 The 5.6 return value would somehow maintain the type prior to the auto-coercion and not violate the unspecified return value of foo. That is, one needs a sig of :(Int,Int-->Int) to also force an Int return value. But then that would be floored to 5. So one way or another you loose precision when making the Num to Int transition. With auto-coercion results '-4 but -3.3' and '2 but 2.3' one could calculate a return value '6 but 5.6' and maintain a maximum of information while staying type safe. Hmm, and floor(-0.0) == -1? But this does not carry over the Num equality -0.0 == +0.0 to Int. So what is more important sign or magnitude? BTW, does floor return an Int or a Num? Regards, TSa. --