Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Functional Inside Out Closure Objects

by hardburn (Abbot)
on May 20, 2004 at 16:56 UTC ( #355014=note: print w/replies, xml ) Need Help??


in reply to Functional Inside Out Closure Objects

How would you implement subclassing?

  • Comment on Re: Functional Inside Out Closure Objects

Replies are listed 'Best First'.
Re: Re: Functional Inside Out Closure Objects
by fletcher_the_dog (Friar) on May 20, 2004 at 17:14 UTC
    I haven't quit worked it out yet, but I think I would do something where if "methods" had a second arguement that was a blessed ref, it would not create a new blessed ref, but would just use the blessed ref it was given. Something like this:
    #!/usr/bin/perl package Foo; use Class::FIOC; use strict; sub new { my $class = shift; my $foo_thing = shift; my $subclass = shift || 0; methods { foo_thing=>sub { print "My foo_thing=$foo_thing\n"; } },$subclass; } #!/usr/bin/perl package Bar; use Foo; our @ISA qw(Foo); use Class::FIOC; use strict; sub new { my $class = shift; my $bar_thing = shift; my $self = methods { bar_thing=>sub { print "My bar_thing=$bar_thing\n"; } } return Foo->new("Hello",$self); }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://355014]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2020-05-28 21:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (166 votes). Check out past polls.

    Notices?