summaryrefslogtreecommitdiff
path: root/opcode.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-09-06 09:18:41 +0000
committerNicholas Clark <nick@ccl4.org>2007-09-06 09:18:41 +0000
commitc5917253cfa0ec36b4c868a1582baaaab99eb0d0 (patch)
tree617731b471122ffb901814d1a2cec921fd95e1a9 /opcode.h
parent5f0a87760bb9130fbd7579236f81db0729b54496 (diff)
downloadperl-c5917253cfa0ec36b4c868a1582baaaab99eb0d0.tar.gz
Make state $zok = slosh(); behave as the Perl 6 design with an implicit
START block. First time through, call slosh() and assign to $zok. Subsequently neither call slosh() nor assign to $zok. Adds a new op ONCE to control the conditonal call and assign. No change to list context, so state ($zok) = slosh() and (state $zok) = ... etc will still repeatedly evaluate and assign. [Can't fix that before 5.10] Use as an RVALUE is as Larry's design - my $boff = state $zok = ...; will evaluate, assign and return first time, and subsequently act as if it were written my $boff = $zok; FIXME - state $zok = ...; won't deparse - I believe op->op_last isn't being correctly set on the sassign, but I don't know how to fix this. This change may be backed out before 5.10. p4raw-id: //depot/perl@31798
Diffstat (limited to 'opcode.h')
-rw-r--r--opcode.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/opcode.h b/opcode.h
index 6ca4d5e25f..76df85cbb9 100644
--- a/opcode.h
+++ b/opcode.h
@@ -393,6 +393,7 @@ EXTCONST char* const PL_op_name[] = {
"getlogin",
"syscall",
"lock",
+ "once",
"custom",
};
#endif
@@ -761,6 +762,7 @@ EXTCONST char* const PL_op_desc[] = {
"getlogin",
"syscall",
"lock",
+ "once",
"unknown custom operator",
};
#endif
@@ -1143,6 +1145,7 @@ EXT Perl_ppaddr_t PL_ppaddr[] /* or perlvars.h */
MEMBER_TO_FPTR(Perl_pp_getlogin),
MEMBER_TO_FPTR(Perl_pp_syscall),
MEMBER_TO_FPTR(Perl_pp_lock),
+ MEMBER_TO_FPTR(Perl_pp_once),
MEMBER_TO_FPTR(Perl_unimplemented_op), /* Perl_pp_custom */
}
#endif
@@ -1522,6 +1525,7 @@ EXT Perl_check_t PL_check[] /* or perlvars.h */
MEMBER_TO_FPTR(Perl_ck_null), /* getlogin */
MEMBER_TO_FPTR(Perl_ck_fun), /* syscall */
MEMBER_TO_FPTR(Perl_ck_rfun), /* lock */
+ MEMBER_TO_FPTR(Perl_ck_null), /* once */
MEMBER_TO_FPTR(Perl_ck_null), /* custom */
}
#endif
@@ -1895,6 +1899,7 @@ EXTCONST U32 PL_opargs[] = {
0x0000000c, /* getlogin */
0x0004281d, /* syscall */
0x0000f604, /* lock */
+ 0x00000600, /* once */
0x00000000, /* custom */
};
#endif