Front page | perl.perl5.porters |
Postings from June 2001
Re: Renaming of :shared
From:
Artur Bergman
Date:
June 24, 2001 13:59
Subject:
Re: Renaming of :shared
Message ID:
B75C2150.19B8%artur@contiller.se
01-06-24 22.17, skrev Artur Bergman på artur@contiller.se följande:
> I would like to suggest again that we rename : shared
>
> It is missnamed since the variable isn't a shared variable between threads,
> it is a read only shared variable between threads.
>
> It should realy say : shared : readonly;
>
> I am suggesting we name it static.
>
> Do we realy want to explain over and over again that shared means it becomes
> readonly, AND readonly AFTER the fork/new thread. That is a very obfuscated
> behaviour.
>
> Maybe it would be better to just have a :readonly; that makes it readonly on
> first assigment and then is implicitly shared between threads? And it makes
> it possible for a user to create something readonly?
>
> Artur
>
>
>
Here is a patch that does it, can be used as boilerplate if we want to
rename it to something else.
Doug, is this OK with you?
diff -ur perl-current-copy/toke.c perl-current/toke.c
--- perl-current-copy/toke.c Sun Jun 24 21:27:12 2001
+++ perl-current/toke.c Sun Jun 24 21:35:43 2001
@@ -3091,7 +3091,7 @@
else if (!PL_in_my && len == 6 && strnEQ(s, "method", len))
CvMETHOD_on(PL_compcv);
#ifdef USE_ITHREADS
- else if (PL_in_my == KEY_our && len == 6 && strnEQ(s, "shared",
len))
+ else if (PL_in_my == KEY_our && len == 6 && strnEQ(s, "static",
len))
GvSHARED_on(cGVOPx_gv(yylval.opval));
#endif
/* After we've set the flags, it could be argued that
diff -ur perl-current-copy/xsutils.c perl-current/xsutils.c
--- perl-current-copy/xsutils.c Sun Jun 24 21:27:12 2001
+++ perl-current/xsutils.c Sun Jun 24 21:32:44 2001
@@ -85,7 +85,7 @@
}
break;
case 's':
- if (strEQ(name, "shared")) {
+ if (strEQ(name, "static")) {
if (negated)
GvSHARED_off(CvGV((CV*)sv));
else
@@ -102,7 +102,7 @@
case 6:
switch (*name) {
case 's':
- if (strEQ(name, "shared")) {
+ if (strEQ(name, "static")) {
/* toke.c has already marked as GvSHARED */
continue;
}
@@ -190,7 +190,7 @@
if (cvflags & CVf_METHOD)
XPUSHs(sv_2mortal(newSVpvn("method", 6)));
if (GvSHARED(CvGV((CV*)sv)))
- XPUSHs(sv_2mortal(newSVpvn("shared", 6)));
+ XPUSHs(sv_2mortal(newSVpvn("static", 6)));
break;
default:
break;