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

Re: Proposed pragma: readonly - summary

Thread Previous | Thread Next
From:
Tom Christiansen
Date:
May 23, 2000 06:34
Subject:
Re: Proposed pragma: readonly - summary
Message ID:
20017.959088834@chthon
>gist of it seemed to me to be that there should be some way of
>preventing the SCALAR slot of a glob from being changed, with the goal
>of making sure the read only SV can't even be replaced.  This way lies
>madness.  Do we go on to make sure the glob as a whole can't be
>changed, even locally?  How about the package the glob is in?  Do we
>bar the use of Safe when there are any constants lurking about that
>might suddenly become not so constant anymore?

Exactly.  There's nothing stopping anyone from playing with the
symbol table directly.  I can always play with $foo::{bar} directly,
or even copy all of %foo:: to %glarch::, save for the 'bar' entry,
and get my own, then replace $main::{foo} with $main::{glarch}.
Symbol tables are global.  That means anybody can add a subroutine
to any package they want, for example, or delete it.  People who
don't like this about Perl need to get over their personal hang-ups,
or else downgrade to a more B&D language.  If you don't want to cahnge
a constant, than don't.  But these fears that someone else WHO IS SOMEONE
INSIDE *YOUR* PROGRAM might go wickedly frobbing your stuff -- well,
that's the siege mentality problem.  Get a new language.

--tom

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