Re: RFC 80 (v2) Exception objects and classes for builtins
[email protected] (Peter Scott) Sun, 13 Aug 2000 19:43:16 -0700
| Newsgroups | perl.perl6.language.flow |
|---|---|
| Message-ID | <[email protected]> |
At 05:27 PM 8/13/00 -0600, Tony Olekshy wrote: >Peter Scott wrote: > > > > Tony Olekshy wrote: > > > > > > Peter Scott wrote, in RFC 80 (v2): > > > > > > > > =item id > > > > > > > > Unique numeric identifier, assigned by perl developers. > > > > > > I'm loath to bother everyone with this but to me the id of an > > > object should be unique to each *instance* of the class. If we had > > > > > > my $e = Exception->New(id => "ABC.1234"); > > > my $f = Exception->New(id => "ABC.1234"); > > > > > > then $e and $f would have the same id, but be different objects. > > > > Yes, the implicit registry bothers me too - not for the core: I > > figure the perl developers can manage a little enumeration class - > > but for external stuff. CPAN could conceivably work since they > > already have a registry for the naming hierarchy, but what about > > when you want to write an in-house thingy [...] > >Sorry I wasn't more clear on this. I'm just saying that "id" is >a bad name for this "labelling" field; if it's called "id" then it >should be guaranteed, by Perl, to be a unique identifier. So I >propose calling it "tag" instead. How about 'code'? 'tag' has other connotations I'd like to avoid. > > > > Line number exception was thrown at. File exception was > > > > thrown in. > > > > > > Should this be line thrown at or line constructed at? Does > > > anyone care? > > > Hmm - what if we made line() and file() return arrays? Then we'd > > also like uncaught exceptions that result in program death to at > > least have the option of a confess() backtrace, and the data would > > be in the object. > >I think the exception constructor should use the constructor's >invocation point, and the throw operation should independently >track the location of the throw. I keep getting lead back the >concept of the exception unwinding stack, a natural place to >keep track of the throws. But they're different things. Your unwinding stack is a place to keep track of rethrown exceptions; mine is a stack backtrace a la confess kept in the 'file' and 'line' attributes of an exception. Each has its own merits. -- Peter Scott Pacific Systems Design Technologies