Michael Lazzaro wrote:
If anyone knows the answer to these two questions, I'd appreciate it.
Only Larry "knows". But I'm prepared to take an educated guess.


1) What do these do?

   my int $n = 5;           # OK
Yes.


   my int $n = 5.005;       # trunc or err?
Truncate to 5 with optional warning (would be my preference).


   my int $n = "5.05ff"     # 5, 0, undef, NaN, or exception?
Truncate to 5 with optional warning (would be my preference).


   my int $n = "fdsjfdf"    # 0, undef, NaN, or exception?
Call C<fail> would be my preference.
That is, let the user decide whether the result is C<undef> or an exception.


2) Do "num" and "int" share a common base "is a number" class, such that (in perl5-ish speak) we can say

if want(numeric) { ... }

to identify both, or is "num" the base class to test for, and "int" a subclass?
The latter would be my expectation. Though it's C<Num>, not c<num>, I believe.

Damian

Reply via email to