If they're redundant, don't do them. Generally speaking, though, they're not redundant. The outcome of each test is independent of the others. Magic can be tied to an element without being tied to the array, and the use of GET and SET magic is independent.
$ perl -MDevel::Peek -E' sub TIESCALAR { bless \my $x; } sub FETCH { 3 } my @a = (6,7); tie $a[1], __PACKAGE__; say $a[0]; say $a[1]; Dump(\@a); ' 6 3 SV = IV(0x9a22324) at 0x9a22328 REFCNT = 1 FLAGS = (TEMP,ROK) RV = 0x9a3c2e8 SV = PVAV(0x9a23174) at 0x9a3c2e8 REFCNT = 2 FLAGS = (PADMY) ARRAY = 0x9a3af28 FILL = 1 MAX = 3 ARYLEN = 0x0 FLAGS = (REAL) Elt No. 0 SV = IV(0x9a21764) at 0x9a21768 REFCNT = 1 FLAGS = (IOK,pIOK) IV = 6 Elt No. 1 SV = PVMG(0x9a64d50) at 0x9a21898 REFCNT = 1 FLAGS = (GMG,SMG,RMG,pIOK,pPOK) IV = 3 NV = 0 PV = 0x9a370d0 "3"\0 CUR = 1 LEN = 12 MAGIC = 0x9a46460 MG_VIRTUAL = &PL_vtbl_packelem MG_TYPE = PERL_MAGIC_tiedscalar(q) MG_FLAGS = 0x02 REFCOUNTED MG_OBJ = 0x9a22258 SV = IV(0x9a22254) at 0x9a22258 REFCNT = 1 FLAGS = (ROK) RV = 0x9a4f4a0
In reply to Re^7: XS: returning a 64-bit unsigned int?
by ikegami
in thread XS: returning a 64-bit unsigned int?
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |