in reply to RFC Magic::Attach

Comments/suggestions:

Can't really comment on the implementation - I don't know the internals well enough.

Replies are listed 'Best First'.
Re: Re: RFC Magic::Attach
by pdcawley (Hermit) on Jan 21, 2003 at 15:54 UTC
    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?

Re: Re: RFC Magic::Attach
by IlyaM (Parson) on Jan 21, 2003 at 14:43 UTC
      It was actually "detach" at first though I changed it because attach/unattach had a better ying/yang to me than attach/detach. Suppose I could alias it.

      -Lee

      "To be civilized is to deny one's nature."