[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

RE: A common base exception object for Perl - RFC



Yes well.. I am using Outlook98, and TomC hates me for it, but that's
another story.

I suppose that is all possible. I have a strong preference for doing things
purely in Perl (not C/XS) that have no effect on other ways to use Perl. The
idea of a sweeping change of all $@'s into Exception objects is simply not
something I think is wise. Not when you can get all the benefits without
doing it. It looks like 100 times more work for trivial gain.

As for the slowness of 'isa' compared to a string comparison; perhaps there
would be some way to optimize 'isa' that would benefit all uses, and avoid
the need for work-arounds. I don't think the work-arounds are going to be
all that beneficial anyway. If I fail to define a 'class' method, then Perl
has to walk up to the base class to find an implementation of 'class' to
invoke.

There's a thought, actually. It is rare/bizarre/foolish for someone to
override 'isa'. By the time 'isa' is found, nearly all the information
needed to answer the question is already known. Perhaps it would be sensible
to optimize the method lookup code to contain the following logic:

	return true if ( looking_for_isa and $_[0] eq current_package );




-----Original Message-----
From: Pete Jordan [mailto:pjordan1@email.mot.com]
Sent: Friday, January 21, 2000 11:06 AM
To: Perl5 Porters
Subject: Re: A common base exception object for Perl - RFC

Fair point, again. An alternative would be (given that
C<$@->isa(Exception)> will it seems always be true) to have a C<class>
method that would default to the package name but be settable to an
arbitrary string. Perl could use the latter facility for internal error
categorisation. You'd lose any hierarchy of exception classes but gain
performance by not having to do isa searches.


[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]