develooper Front page | perl.perl5.porters | Postings from July 2001

Re: [Help] Salvage the Array Hash Monster.

Thread Previous | Thread Next
From:
Sam Tregar
Date:
July 26, 2001 20:39
Subject:
Re: [Help] Salvage the Array Hash Monster.
Message ID:
Pine.LNX.4.33.0107262335260.2516-100000@localhost.localdomain
On Fri, 27 Jul 2001, Autrijus Tang wrote:

> I'm aware that one can overload deferencing operators for @{} and
> %{} constructs, but that's inadequate for slice access and other
> circumstances.

That's what tie is for.  Your object can store the two tied objects - the
array tie and the hash tie.  Then you can dispatch to the appropriate
object when ->[] or ->{} is called.

Is there some reason this doesn't work?  I'd like to know about it since
I'm planning to do something very similar for associative lists in
Guile.pm.  Users should be able to access them as lists and as hashes, so
I'll have two tied objects per assoc list and use the appropriate one
depending on the method called.

-sam


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