New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support using $? variables and implement $?PROGRAM #698
Comments
From @chrisdolanThis patch adds support for '?' twigil variables to actions.pm and git pull git://github.com/chrisdolan/rakudo.git program-name t/spec/S02-magicals/progname.t updated to test this in r25324 |
From @chrisdolan0001-Support-using-variables-and-implement-PROGRAM.patchFrom df1ec6e81258e8af6ea6ca0e1654b075f42ae781 Mon Sep 17 00:00:00 2001
From: Chris Dolan <chris@chrisdolan.net>
Date: Fri, 13 Feb 2009 23:00:57 -0600
Subject: [PATCH] Support using $? variables and implement $?PROGRAM
---
src/builtins/guts.pir | 7 ++++++-
src/parser/actions.pm | 6 ++++++
2 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/src/builtins/guts.pir b/src/builtins/guts.pir
index 69cd7d0..1f737ad 100644
--- a/src/builtins/guts.pir
+++ b/src/builtins/guts.pir
@@ -312,8 +312,13 @@ first). So for now we just transform multis in user code like this.
start_main:
## We're running as main program
- ## Remove program argument (0) and set up @ARGS global
+
+ ## Remove program argument ($?PROGRAM) and set up @ARGS global
$P0 = shift args
+ $P1 = get_hll_global [ "Bool" ], "True"
+ setprop $P0, "readonly", $P1
+ set_hll_global "$?PROGRAM", $P0
+
args = args.'Array'()
set_hll_global '@ARGS', args
## run unitmain
diff --git a/src/parser/actions.pm b/src/parser/actions.pm
index 7f1f339..9e0fb50 100644
--- a/src/parser/actions.pm
+++ b/src/parser/actions.pm
@@ -1972,6 +1972,12 @@ method variable($/, $key) {
$var.viviself( container_itype($sigil) );
}
+ # If it has a '?' twigil, it's a compiler hint var.
+ if $twigil eq '?' {
+ $var.namespace(@ns);
+ $var.scope('package');
+ }
+
## @_ and %_ add a slurpy param to the block
if $varname eq '@_' || $varname eq '%_' {
unless $?BLOCK.symbol($varname) {
--
1.6.1
|
From @chrisdolanOn Fri Feb 13 21:14:59 2009, chris@chrisdolan.net wrote:
Larry changed the spec 5 minutes after I submitted this, so $?PROGRAM is |
The RT System itself - Status changed from 'new' to 'open' |
From @cokeOn Fri Feb 13 21:50:40 2009, chrisdolan wrote:
Very sorry, this patch seems to have gotten lost in RT, and even the part Thanks for the patch, we'll try to get to them faster in the future! -- |
@coke - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#63228 (status was 'rejected')
Searchable as RT63228$
The text was updated successfully, but these errors were encountered: