Re: Int-to-Num autocoercion

2007-01-30 Thread Darren Duncan
At 9:07 PM +0100 1/30/07, TSa wrote: BTW, does floor return an Int or a Num? A floor() returns an Int of course, because by definition floor() returns an integer. See http://en.wikipedia.org/wiki/Floor_function for an explanation. Same with ceiling(), and some other operators. If anything,

Re: Int-to-Num autocoercion

2007-01-30 Thread TSa
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 t

Int-to-Num autocoercion

2007-01-30 Thread Larry Wall
On Tue, Jan 30, 2007 at 06:02:59PM +0100, TSa wrote: : How are coercions handled when calling functions? : : sub identity ( Int $i ) { return $i } : : my Num $x = 3.25; : : say indentity($x); # prints 3 or type error? Or even 3.25? : : I'm opting for type error on the footing that Int <: