I'm trying to implement a generic magical array system for special
arrays, similar to magic_get/set/len for special scalars. However, I'm not
quite sure how to transfer the magicalness onto the elements of an array.
Here's what I have so far:

EXT MGVTBL PL_vtbl_av=  {0, 0,  MEMBER_TO_FPTR(Perl_magic_avsize),  0, 0};
EXT MGVTBL PL_vtbl_avelem = {MEMBER_TO_FPTR(Perl_magic_get_avelem),
                             MEMBER_TO_FPTR(Perl_magic_set_avelem),
                             0,
                             MEMBER_TO_FPTR(Perl_magic_clear_avelem),
                             0};

(I think these tables should be enough to implement @(, @) and to replace the
implementation of @ISA.)

Now, I've been looking at %SIG and @ISA, and I see where their magicalness is
set, but I have no idea how, for instance, "i" magic is applied to the
elements of the array. Well, I can, sort of:

    if (SvSMAGICAL(av)) {
        if (val != &PL_sv_undef) {
            MAGIC* mg = SvMAGIC(av);
            sv_magic(val, (SV*)av, toLOWER(mg->mg_type), 0, key);
        }
        mg_set((SV*)av);
    }

But that's in store, not fetch; what about arrays with get magic?
Oh, and I'm planning on using "Z" and "z" for the array and element
virtual types.

-- 
"The Write Many, Read Never drive. For those people that don't know their
 system has a /dev/null already." - Rik Steenwinkel on Exabyte drives, ASR

Reply via email to