Re: RFC 189 (v1) Objects : Hierarchical calls to initializers and destructors

2000-09-02 Thread Michael G Schwern
On Sat, Sep 02, 2000 at 11:05:23AM +1100, Damian Conway wrote: This bothers me. It leaves no way to override the behavior of a parent's SETUP and DESTROY, you can only overlay. You mentioned that this is normal for most other OO languages, so I presume there's a way to deal

Re: RFC 189 (v1) Objects : Hierarchical calls to initializers and destructors

2000-09-02 Thread Nathan Wiger
Michael G Schwern wrote: Derived classes will never have to override a base's implementation, and all member variables should be private, and everyone will always use an accessor, and the UN will bring about world peace, and as long as I'm wishing for a perfect world, I'd like a pony. ;)

Re: RFC 189 (v1) Objects : Hierarchical calls to initializers and destructors

2000-09-02 Thread John Siracusa
On 9/2/00 11:34 AM, Nathan Wiger wrote: It doesn't seem that it's that hard to add a single line to your SETUP or BLESS or whatever method that calls SUPER::SETUP. I'm pretty sure one of the big points about the system described is that it ensures both that there's always a predictable and

Re: RFC 189 (v1) Objects : Hierarchical calls to initializers and destructors

2000-09-02 Thread Tom Christiansen
The whole notion of blessing is non-obvious enough already. It's the benedictory (con)not(at)ion of blessing, not the bless()ing itself that so confuses people, I think. It bless() were instead named something like mark stamp label brand retype denote notate

Re: RFC 189 (v1) Objects : Hierarchical calls to initializers and destructors

2000-09-02 Thread John Tobey
On Sat, Sep 02, 2000 at 12:16:48AM -0400, John Tobey wrote: I agree with Michael that SETUP should be BLESS. You argue that it Oops, I mean Nate. Sorry, Michael! -John

Re: RFC 189 (v1) Objects : Hierarchical calls to initializers and destructors

2000-09-02 Thread Mike Lambert
I can most certainly think of cases where a base class's DESTROY does something a derived class doesn't like. Consider your example, File::Lock. File::Lock::DESTROY calls flock($fh, LOCK_UN). I derive File::Lock::Mac from File::Lock. Uh oh, Macs don't implement flock! Under your

Re: RFC 189 (v1) Objects : Hierarchical calls to initializers and destructors

2000-09-02 Thread Matt Youell
goes? Your logic suggests that I'd never want to meddle in the base's implementation. What happens when the base classes' author finally fixes the problem you wrote around (and incidentally changes touchy implementation details in the base)? What happens someday when you can't see the

Re: RFC 189 (v1) Objects : Hierarchical calls to initializers and destructors

2000-09-02 Thread Damian Conway
Also, its not entirely clear why method chaining is desired only for constructor and destructors. What about every other method? Constructors and destructors are special. They're not about *doing* something; they're about *being* (or not being) something. A "doing" method *may* wish to

Re: RFC 189 (v1) Objects : Hierarchical calls to initializers and destructors

2000-09-02 Thread Michael G Schwern
On Sat, Sep 02, 2000 at 03:13:17AM -0700, Matt Youell wrote: What happens when the base classes' author finally fixes the problem you wrote around (and incidentally changes touchy implementation details in the base)? What happens someday when you can't see the implementation of the base

Re: RFC 189 (v1) Objects : Hierarchical calls to initializers and destructors

2000-09-02 Thread Michael G Schwern
On Sat, Sep 02, 2000 at 03:18:06PM -0400, Mike Lambert wrote: In certain cases, like the one in which you proposed, you'd want to explicitly bypass the parent DESTROY. sub DESTROY { my $self = shift; $self-UNIVERSAL::DESTROY(@_); } would skip the automatic chaining because the

Re: RFC 189 (v1) Objects : Hierarchical calls to initializers and destructors

2000-09-02 Thread Damian Conway
Yes, welcome to the dirty, icky real world. Life sucks, people will write bad code, you will have to inherit from it. Sometimes you have to break a little encapsulation to make an omlet. I'd rather it was not so, but its better to accept it and deal than deny. Of

RFC 189 (v1) Objects : Hierarchical calls to initializers and destructors

2000-09-01 Thread Perl6 RFC Librarian
This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE Objects : Hierarchical calls to initializers and destructors =head1 VERSION Maintainer: Damian Conway [EMAIL PROTECTED] Date: 1 September 2000 Mailing List: [EMAIL PROTECTED] Version: 1 Number:

Re: RFC 189 (v1) Objects : Hierarchical calls to initializers and destructors

2000-09-01 Thread Damian Conway
Furthermore, it proposes that both CSETUP and CDESTROY methods should be invoked hierarchically in all base classes. This bothers me. It leaves no way to override the behavior of a parent's SETUP and DESTROY, you can only overlay. You mentioned that this is normal for

Re: RFC 189 (v1) Objects : Hierarchical calls to initializers and destructors

2000-09-01 Thread Mike Lambert
=head2 Hierarchical CSETUP calls It is proposed that when an object is blessed, Iall of the CSETUP methods in any of its base classes are also called, and passed the argument list appended to the invocation of Cbless. CSETUP methods would be called in depth-first, left-most order (i.e.

Re: RFC 189 (v1) Objects : Hierarchical calls to initializers and destructors

2000-09-01 Thread John Tobey
On Fri, Sep 01, 2000 at 08:59:10PM -, Perl6 RFC Librarian wrote: =head1 ABSTRACT This RFC proposes a new special method called CSETUP that is invoked automagically whenever an object is created. Furthermore, it proposes that both CSETUP and CDESTROY methods should be invoked

Re: RFC 189 (v1) Objects : Hierarchical calls to initializers and destructors

2000-09-01 Thread John Siracusa
On 9/1/00 5:44 PM, Nathan Wiger wrote: sub SETUP { my ($self, @ctor_data) = @_; # initialization of object referred to by $self occurs here } Hmmm. I'm not sure if I like this. I like the *idea* a lot, but I must say that I think I quite like RFC 171's approach better. I haven't

Re: RFC 189 (v1) Objects : Hierarchical calls to initializers and destructors

2000-09-01 Thread Michael G Schwern
On Fri, Sep 01, 2000 at 08:59:10PM -, Perl6 RFC Librarian wrote: Furthermore, it proposes that both CSETUP and CDESTROY methods should be invoked hierarchically in all base classes. This bothers me. It leaves no way to override the behavior of a parent's SETUP and DESTROY, you can only

Re: RFC 189 (v1) Objects : Hierarchical calls to initializers and destructors

2000-09-01 Thread Nathan Wiger
The typical constructor would then be reduced to: package MyClass; sub new { bless {}, @_ } with initialization handled in a separate CSETUP routine: sub SETUP { my ($self, @ctor_data) = @_; # initialization of object referred