In a message dated Thu, 5 Sep 2002, Luke Palmer writes:
> Why would bitwise have anything but integer signatures. What does
> 4.56 | 2.81 mean?   Also, should perl lossily convert real to int, or give
> an error if it can't?

Seems to me that that's a decision that has to be made for each function.

  sub needsInt (int $a) {
     # Perl will throw exception if passed real
     ...
  }
  sub convertIntSilently (real $a) {
     $a = int($a);
     ...
  }
  sub warnUnlessInt (real $a) {
     warn Error::LossyConversion.new(target => $a, to => int)
        unless $a.isa(int);
     $a = int($a);
     ...
  }

(I'm just making up that warn statement, obviously...)

Trey

Reply via email to