develooper Front page | perl.perl5.porters | Postings from May 2000

Re: Proposed pragma: readonly

From:
Mark Summerfield
Date:
May 20, 2000 11:18
Subject:
Re: Proposed pragma: readonly
Message ID:
3926D65E.213C559E@queenwood.screaming.net
Mark, Andreas, Tom,

Mark-Jason Dominus wrote:
> 
> Andreas J. Koenig wrote:
> >
> > I found again Graham's posting with a tie() solution for scalars,
> > arrays and hashes:
> >
> > http://www.xray.mpe.mpg.de/mailing-lists/modules/1999-02/msg00090.html
> 
> The Locked.pm module does something similar:
> 
>         http://www.plover.com/~mjd/perl/Locked/

Yes I did a tied implementation myself originally a few years back:
	Tie::Const at http://www.perlpress.com/perl/antiques.html
but the problem with the tie approach is they make constants slower when
constants should surely be faster!

The solution Tom uses looks ideal, no tie slowdown, you can make
something const at runtime which is a bonus. Only downside is it isn't
in the std distrib or on CPAN...
I'll try it (never done any XS before, the "make && make test && make
install" incantation does all that for me) & let you know.

Thanks.
_______________________________________________
Mark Summerfield       http://www.perlpress.com



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About