"Brust, Corwin" wrote:
>
> Tony Olekshy wrote:
> >
> > Throw can't take no arguments because it's a constructor
>
> If $@ always contains an exceptions we don't need to construct one to
> throw.
Um, but, $@ doesn't contain an exception until you throw an exception.
You still have to construct an exception to put into $@, just as you
have to construct a string to have C<die> put said string to $@.
In fact, in RFC 88, this works just fine:
die Exception->new("Can't foo.", tag => "ABC.1234", ...);
and, in fact that's just what "throw", a *constructor* method of the
Exception class, does (after constructing $self) when you write:
throw Exception "Can't foo.", tag => "ABC.1234", ...;
Making throw a method of Exception just means we don't have to say
throw Exception->new("Can't foo.", tag => "ABC.1234", ...);
and it means throw isn't a new keyword, and that throw $@ can,
invoked now as an instance method rather than a constructor,
do the right thing.
However, a bare C<throw> doesn't make sense now, because it's a method.
Yours, &c, Tony Olekshy