Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing magic during magic #2314

Open
p5pRT opened this issue Aug 4, 2000 · 1 comment
Open

Removing magic during magic #2314

p5pRT opened this issue Aug 4, 2000 · 1 comment

Comments

@p5pRT
Copy link

p5pRT commented Aug 4, 2000

Migrated from rt.perl.org#3638 (status was 'open')

Searchable as RT3638$

@p5pRT
Copy link
Author

p5pRT commented Aug 4, 2000

From jason@desktop.com

Created by jason@desktop.com

I was working on a package providing lightweight lazy objects- tied
structures which would untie and populate the underlying structure
on access. This somewhat perverse approach works fine in simple
cases, but in general breaks horribly because the interpreter seems
to assume that magic is still present after dispatching to tie
methods.

Hashes are fairly well behaved except for 'each'. Patching began on
that issue, but I soon found that

  $foo = $hash{key} = 'assign';

broke, probably due to internal optimizations. What I found next
while testing arrays caused me to shelve this effort and submit this.

From what I understand of the current state of magic, it is up to
accessors to check for magic and do the right thing. Even if I did
catch all of the issues in the interpreter, I would never catch up
with all of the XS modules out there.

If magic becomes transparent in the API, an implementation such as
this might be possible- but only if the effects of an 'untie' within
a tie method become defined. Is it worth the effort?

...

Example code and test suite available for the curious. Array tests
unfinished due to author running screaming from the room.

  $#{$ref} = -1;
  print $#{$ref};
  print scalar @​$ref;

-1
6

Perl Info

Flags:
    category=core
    severity=wishlist

Site configuration information for perl v5.6.0:

Configured by bbuchanan at Mon Jul 24 11:32:24 PDT 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.2.5-15, archname=i686-linux
    uname='linux penseur.jumpdata.com 2.2.5-15 #1 mon apr 19 23:00:46 edt 1999 i686 unknown '
    config_args='-des -O -Dprefix=/dt/vendor -Dlocincpth=/dt/vendor/include -Dloclibpth=/dt/vendor/lib -Dvendorprefix=/dt/server/perl5 -Dvendorbin=/dt/server/bin -Dvendorscript=/dt/server/bin -Dvendorlib=/dt/server/lib/perl5/5.6.0 -Dvendorman1=/dt/server/man/man1 -Dvendorman3=/dt/server/man/man3 -Dvendor=desktop.com -Dappllib=/dt/islands/lib/perl5 -Dbincompat5005 -Accflags=-DPERL_POLLUTE'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='cc', optimize='-O2', gccversion=egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
    cppflags='-DPERL_POLLUTE -fno-strict-aliasing -I/dt/vendor/include'
    ccflags ='-DPERL_POLLUTE -fno-strict-aliasing -I/dt/vendor/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/dt/vendor/lib'
    libpth=/dt/vendor/lib /lib /usr/lib /usr/local/lib
    libs=-lnsl -lndbm -lgdbm -ldbm -ldb -ldl -lm -lc -lposix -lcrypt
    libc=/lib/libc-2.1.1.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/dt/vendor/lib'

Locally applied patches:
    


@INC for perl v5.6.0:
    /dt/islands/lib/perl5
    /dt/vendor/lib/perl5/5.6.0/i686-linux
    /dt/vendor/lib/perl5/5.6.0
    /dt/vendor/lib/perl5/site_perl/5.6.0/i686-linux
    /dt/vendor/lib/perl5/site_perl/5.6.0
    /dt/vendor/lib/perl5/site_perl
    /dt/server/lib/perl5/5.6.0/i686-linux
    /dt/server/lib/perl5/5.6.0
    /dt/server/lib/perl5
    .


Environment for perl v5.6.0:
    HOME=/u/jason
    LANG=en_US
    LANGUAGE (unset)
    LC_ALL=C
    LD_LIBRARY_PATH=/dt/vendor/lib:/dt/server/lib:/dt/vendor/lib:/dt/server/lib:/dt/vendor/lib:/dt/server/lib:
    LOGDIR (unset)
    PATH=.:~/bin:/dt/vendor/bin:/dt/server/bin:/usr/etc:/usr/sbin:/usr/bin:/usr/local/bin:/bin:/usr/bin/X11
    PERL_BADLANG (unset)
    SHELL=/bin/bash


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants