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

Re: [perl #47948] [documentation] Hash::Util::FieldHash

Thread Previous | Thread Next
From:
demerphq
Date:
July 11, 2013 11:12
Subject:
Re: [perl #47948] [documentation] Hash::Util::FieldHash
Message ID:
CANgJU+VxLuVwpO23vcwx0KVGNTjSuy=8LW8_O8NF=Ob4OZ4Akg@mail.gmail.com
On 11 July 2013 02:51, Father Chrysostomos via RT
<perlbug-followup@perl.org> wrote:
> On Wed Jul 10 13:15:12 2013, demerphq wrote:
>> But I believe that the documentation in question is about field
>> hashes, and not normal perl hashes, so it seems to me the question is
>> irrelevant to answering this ticket. They seem like some kind of tie,
>> and are definitely magic, so it seems to me they can do whatever they
>> like.
>
> Field hashes are actually quite different from tied hashes.  They are
> regular perl hashes with extra magic attached to the elements to do some
> extra bookkeeping behind the scenes.  But that magic does not intercept
> the regular store/fetch operations of plain hashes.
>
> In fact, the field hash magic is orthogonal to ties, so you can actually
> tie a field hash.  namespace::clean uses that.

Be that as it may field hashes aren't normal hashes, and until someone
carefully reviews the implementation I would assume that the
documentation by the author is correct.

Clearly there is *some* form of magic involved, the magic could do
whatever it wants, including modifying the hash during traversal,
which depending on how it was implemented *could* "throw the hash
iterator".

I stand by my claim that field hashes aren't normal hashes, and should
not be expected to behave as them. It really doesn't matter if they
are a true tie, or some other kind of magic hash, the fact is they are
magic, and the only guarantees we make are about *non* magic hashes.

So IMO field hashes can do whatever they like and all the commentary
in this thread regarding the documentation of *true* perl hashes is
irrelevant.

Yves


--
perl -Mre=debug -e "/just|another|perl|hacker/"

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