develooper Front page | perl.perl6.language | Postings from June 2005

Re: OO magic (at least for me)

Thread Previous | Thread Next
From:
Piers Cawley
Date:
June 26, 2005 08:54
Subject:
Re: OO magic (at least for me)
Message ID:
m2slz5qfk9.fsf@obelisk.bofh.org.uk
BÁRTHÁZI András <andras@barthazi.hu> writes:

> Hi,
>
> I'm wondering, if it's possible with Perl 6 or not?
>
> class MyClass {
>
> 	method mymethod($par) {
> 		say "mymethod called!";
> 	}
>
> }
>
> class ExClass is MyClass {
>
> 	mymethod(12);
>
> }
>
> #> pugs myprog
> mymethod called!
>
> I would like to use mymethod to add ExClass some methods, etc.
>
> ///
>
> Just another problem, related to the above:
>
> class MyClass {
>
> 	method whenmother() {
> 		say "MyClass is parent now!!!";
> 		say "Her child name is: " ~ ????;
> 	}
>
> }
>
> class Child is MyClass {
> }
>
> #> pugs myprog
> MyClass is parent now!!!
> Her child name is: Child

I'd like to hope so. Actually, I don't think that this *specific* functionality
should be in the core, but the ability to implement it (just needs a unified
notifcation scheme that gets tickled when new classes, methods, subs, packages,
etc, get added to the image -- more detailed behaviour is a SMOP).

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