develooper Front page | perl.perl6.language | Postings from July 2001

Re: Per-object inheritance in core a red herring?

Thread Previous | Thread Next
From:
David L. Nicol
Date:
July 10, 2001 00:44
Subject:
Re: Per-object inheritance in core a red herring?
Message ID:
3B4AB0A7.CA4F1B22@kasey.umkc.edu
schwern@pobox.com wrote:
> Anyhow, if you want Perl 6 objects to be able to act as if they're in
> their own class (ie. have their own methods, inheritance, etc...) how
> are you going to do this without having the moral equivalent of a
> stash associated with it?  And if you can do something that saves
> memory on object inheritance, why not apply it to class inheritance?

what if there was a core shortcut that hid the virtual methods -- the
selecte methods that are allowed to be overridden on a per-object basis
just like in C++

Without the core shortcut, you'd have:

	package moderatable_fido;
	sub new{
		my $self = {};
		$self->{sound} = \&dobark;
		bless $self;
	};
	sub dobark { print "Woof!\n" }
	sub bark { goto &{$_[0]->{sound}} }

incorporating such a declared virtual into Class::Object -- is it there
already?



-- 
                                           David Nicol 816.235.1187
                   "Perl was born in downtown Hell!" -- Matt Youell


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About