(Sorry for responding to my own post, and on a tangential point at that,
but...)

In a message dated Thu, 5 Sep 2002, Trey Harris writes:

> 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
>      ...
>   }

Hmmm.  Since we'll have subroutine overloading in Perl 6, the exception
here has the potential to be unenlightening ("sub needsInt(scalar) not
found", or some such).  I've found this really annoying in Java, because
you have to know the actual signature of the method you're calling as well
as the inheritance heirarchy of the argument you're trying to pass.

This is really getting down into nitty-gritty details way too early at
this point, but I hope that we can do better than Java in error messages
for this sort of thing.  (Maybe do a reverse multimethod match, if you get
my drift, to figure out what the closest signature is you *couldn't* call,
and put that in the error message: "needsInt(real) called, expecting
needsInt(int)".)

I usually feel like I'm spending most of my time converting objects from
one class to another whenever I write Java.  So that might be an argument
against using specific typing in Perl 6 builtins--converting arguments for
type conformance is a very un-Perlish thing.

Trey


Reply via email to