Jarkko Hietaniemi wrote:
> 
> On Tue, Aug 22, 2000 at 11:07:44PM -0700, Peter Scott wrote:
> >
> > I think this should be perl6-language-errors
> 
> I scoured the -errors but all I could see was fancy-schmanzy talk
> about OOish exceptions, that's why I wrote the anti-OO section.
> Unless we get OO faster than its own shadow, I want OO nowhere near
> low-level system calls.

The exception handling mechanism proposed by RFC 88, which has been
involved in much of the discussion on -errors, is a completely
procedural mechanism.  Also, there is a concensus on -errors that
system functions automatically generate exceptions for errors only
if C<use fatal;> is in scope.

Objects are only used as a convenient way to represent the exceptions
themselves.  One could easily unbless said data strucures to get
"non-OO" exceptions, and move the methods into a function library.

The fields of this data structure would contain things like what
are now $@, $!, $?, and $^E, probably __FILE__ and __LINE__, and
maybe a few other things.

The ability to use the exception class hierarchy as a convenient
way to select exceptions for catching would be lost, but it could
be simply replaced by a new field in the exception data structure
(perhaps with some added support functions).  Also, throw would be
a function, not a method.

Not only can RFC 88 be done without exception objects per se, the
ones it does use for the purpose of discussion are about as light-
weight as they get in Perl.  Just a blessed hash with a few public
methods.  The beauty is, all the support functions are now under
the Exception:: namespace, but you only have to write $@->foo().
That level of "OO" is likely to supported well by Perl 6.

Certainly C<use strict 'system'> and C<use fatal> could both go
in, one just typically wouldn't use both techniques together.

Sorry to take time on this, but I'm not anti- or pro-OO.  It's
just another technique, it works well for exceptions themselves,
it does not work well for exception handling itself (that is, as
I said, better off being procedural).

Yours, &c, Tony Olekshy

PS: The current draft of RFC 88 is here:
Formatted:   http://www.avrasoft.com/perl/rfc/rfc88v2d5.htm
POD as text: http://www.avrasoft.com/perl/rfc/rfc88v2d5.txt

Reply via email to