Message from discussion
is static?
Newsgroups: perl.perl6.language
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.perl.org
Return-Path: <la...@london.wall.org>
Mailing-List: contact perl6-language-h...@perl.org; run by ezmlm
Delivered-To: mailing list perl6-langu...@perl.org
Delivered-To: perl6-langu...@perl.org
Date: Sat, 15 Mar 2003 18:29:41 -0800
Subject: Re: is static?
In-reply-to: <001201c2eb58$1373c9c0$cf6e1918@carolina.rr.com>
To: perl6-langu...@perl.org
Mail-followup-to: perl6-langu...@perl.org
Message-ID: <20030316022941.GB931@wall.org>
MIME-version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
Content-Disposition: inline
User-Agent: Mutt/1.4i
References: <x7of4c7cj0.fsf@mail.sysarch.com> <20030315183530.23859.qmail@onion.perl.org> <001201c2eb58$1373c9c0$cf6e1918@carolina.rr.com>
X-SMTPD: qpsmtpd/0.21-dev, http://develooper.com/code/qpsmtpd/
X-Spam-Check-By: one.develooper.com
X-Spam-Status: No, hits=-1.9 required=7.0 tests=CARRIAGE_RETURNS,IN_REP_TO,REFERENCES,SPAM_PHRASE_02_03,USER_AGENT,USER_AGENT_MUTT version=2.44
X-SMTPD: qpsmtpd/0.20, http://develooper.com/code/qpsmtpd/
Approved: n...@nntp.perl.org
From: la...@wall.org (Larry Wall)
Lines: 46
On Sat, Mar 15, 2003 at 08:05:03PM -0500, Joe Gottman wrote:
:
: ----- Original Message -----
: From: "Dave Whipp" <d...@whipp.name>
: To: <perl6-langu...@perl.org>
: Sent: Saturday, March 15, 2003 1:35 PM
: Subject: Re: is static?
:
:
: > Uri Guttman wrote:
: > > talking about nested subs brought up another related idea, static (not
: > > on the stack) lexicals inside subs.
: >
: > Doesn't C<our> give you this?
: >
:
: Not really. A variable declared with <our> can be accessed from
: anywhere in the program, just by redeclaring it or calling it with the
: "package::" syntax. A variable declared with <my> can be accessed outside
: its scope only if the user returns a reference to it. A static variable
: should be like a <my> variable except that it is only initialized once and
: is not destroyed when it goes out of scope.
It is likely that if we have "is static", the compiler would translate
my $pi is static = 3
to something like
our $foo__Xdeadbeef will init {.set(3)}
I really hate the word "static" though, which is why I suggested an alternative
once of something like
our $foo is unique;
where "is unique" (or whatever) monkeys with the name to make it unique. Then
the program representation is closer to what's actually going on.
On the other hand, "is static" would be instantly recognizable to
C programmers. Maybe they're due for a sop...
It's not like someone isn't going to implement "is static" the moment
our back is turned anyway...
Larry