Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Re: RFC Magic::Attach

by pdcawley (Hermit)
on Jan 21, 2003 at 15:54 UTC ( [id://228717]=note: print w/replies, xml ) Need Help??


in reply to Re: RFC Magic::Attach
in thread RFC Magic::Attach

Have we considered how nicely this would play with scalar attributes? One could imagine appropriate Attribute::Handlers hanging their data off arbitrary scalars. Then one could imagine:
sub UNIVERSAL::property { require Magic::Attach; my $self = shift; my $property_name = shift; return Magic::Attached::attached($self, $property_name); } sub UNIVERSAL::but { require Magic::Attach; my $self = shift; my($property_name, $value) =@_; Magic::Attach::attach($self, $property_name, $value); }
and the like.

The fun begins when you start to try and implement Perl6ish tricks along the lines of return $value->but('true') or (possibly nicer) return $value :but('true'); . For this to work really well you would need have 'but' dispatch to appropriate handlers in some way (possibly through a registry system), but it's not beyond the wit of man...

Can you tell I've been thinking along these lines for a while but have lacked the appropriate tuits?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2024-04-26 06:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found