[Israel.pm] Perl Advocacy

Gaal Yahas gaal at forum2.org
Wed Dec 29 12:19:08 PST 2004


Gabor Szabo wrote:

>> Hashes are not arrays, and arrays are not hashes. As I said in my first
>> post to this thread, you can write use Perl's tie mechanism to write a
>> hashish array. Mostly you would need to keep a high watermark for the
>> tied object, and write some code in STORE (you have no FETCHSIZE for
>> hashes) to overcome sparsity.
> 
> Hmm, this seems familiar. I think I wrote a module with some similar
> level of stupidity. But at least it got my name on CPAN.

Oh, I don't think that's stupid at all! In those cases that it
can be useful, I'm sure it can, well, be useful :)

I just don't want to pay the penalty all the time. This is exactly
the kind of thing perltie is for. Of course, in *those* cases it
isn't as fast as it could have been if it were part of the optimized-
-to-death perl core. But well, if you want PHP, you know where to find
it.

Gaal


PS: I wouldn't disagree with someone who said it's a pity the tie
interface doesn't have FETCHSIZE for hashes, either. Though in the
case of hashish arrays ("arrays on weed"?) it isn't entirely
obvious if it should return the number of elements, or double that.

-- 
Gaal Yahas <gaal at forum2.org>
http://gaal.livejournal.com/



More information about the Perl mailing list