Re: [Templates] Design question

[prev] [thread] [next] [Date index for 2004/06/29]

From: Perrin Harkins
Subject: Re: [Templates] Design question
Date: 03:21 on 29 Jun 2004
Buddy Burden wrote:
> I want something that acts like both a hash and an array.  The easiest 
> way (AFAIK, anyway) is to make an object with overloaded hash and array 
> dereferencing.

I actually have never heard of anyone doing that before.  A more common 
approach is to simply implement the tied hash interface, like 
Tie::IxHash does.  What you're doing sounds like overloading, not tie-ing.

> The overloaded array deref just returns the array that 
> the data's stored in.  But the overloaded hash deref can't do that, 
> because the data's not stored in a hash (and can't be unless I want to 
> keep two copies of the data)

That's what most of the other modules do.  Seems like a reasonable 
solution in most cases, but can be a problem with huge amounts of data.

> it's more about having something that _mostly_ acts like a hash, 
> but also has some limitations (such as the original pseudohashes, or 
> replacements for them such as Tie::Hash::FixedKeys).

FYI, the official way to do this now is with Hash::Util, which is part 
of the core library.

- Perrin

_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

(message missing)

[Templates] Design question
Buddy Burden 18:58 on 28 Jun 2004

Re: [Templates] Design question
Jeff Anderson 19:16 on 28 Jun 2004

Re: [Templates] Design question
Mark Mills 19:16 on 28 Jun 2004

Re: [Templates] Design question
Buddy Burden 20:20 on 28 Jun 2004

RE: [Templates] Design question
Bruce McKenzie 20:46 on 28 Jun 2004

Re: [Templates] Design question
Ken.Olstad 20:55 on 28 Jun 2004

Re: [Templates] Design question
Perrin Harkins 21:25 on 28 Jun 2004

Re: [Templates] Design question
Jeff Anderson 21:47 on 28 Jun 2004

Re: [Templates] Design question
Buddy Burden 16:11 on 01 Jul 2004

Re: [Templates] Design question
Jeff Anderson 18:05 on 01 Jul 2004

Re: [Templates] Design question
Buddy Burden 22:33 on 28 Jun 2004

Re: [Templates] Design question
Perrin Harkins 22:52 on 28 Jun 2004

Re: [Templates] Design question
Buddy Burden 23:18 on 28 Jun 2004

Re: [Templates] Design question
Perrin Harkins 03:21 on 29 Jun 2004

Re: [Templates] Design question
Buddy Burden 16:22 on 29 Jun 2004

Re: [Templates] Design question
Mark Mills 17:09 on 29 Jun 2004

Re: [Templates] Design question
Buddy Burden 17:47 on 29 Jun 2004

[Templates] Design question
Chris Ochs 06:53 on 08 Dec 2004

Generated at 08:55 on 15 Mar 2005 by mariachi v0.52