-
Notifications
You must be signed in to change notification settings - Fork 1
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
@_ is writeable in subroutines without explicit signature in Rakudo; shouldn't be #1432
Comments
From @masak<masak> rakudo: sub foo { @_[0] = "bah" }; my $a = "!"; foo($a); say $a |
From @kylehaThis is an automatically generated mail to inform you that tests are now available in t/spec/S06-signature/unspecified.t commit feadec2cec905db9b25b782725463e449c7a0006 [t/spec] Test for RT 71112: Cannot assign to readonly variable. Inline Patchdiff --git a/t/spec/S06-signature/unspecified.t b/t/spec/S06-signature/unspecified.t
index 6bf0ed9..d9133f6 100644
--- a/t/spec/S06-signature/unspecified.t
+++ b/t/spec/S06-signature/unspecified.t
@@ -1,7 +1,7 @@
use v6;
use Test;
-plan 15;
+plan *;
# L<S06/Perl5ish subroutine declarations/You can declare a sub without
# parameter list>
@@ -41,4 +41,15 @@ is both( 'x', :delta<echo>, 'foxtrot' ), 'foxtrotecho',
is both(), '',
'sub using both named and position params works with no params';
+# RT 71112
+{
+ sub rt71112 { @_[0] = 'bug' }
+ my $tender = 'sanity';
+ #?rakudo todo 'RT 71112: Cannot assign to readonly variable.'
+ dies_ok { rt71112( $tender ) }, 'Sub that tries to modify @_ dies';
+ is $tender, 'sanity', 'The variable passed is unchanged.';
+}
+
+done_testing;
+
# vim: ft=perl6 |
The RT System itself - Status changed from 'new' to 'open' |
From @bbkrNOM: still broken (allows to modify @_) bbkr:nom bbkr$ ./perl6 -e 'sub foo { @_[0] = "bah" }; my $a = "!"; |
From @jnthnOn Mon Dec 07 21:36:46 2009, masak wrote:
The ruling is that, since *@_ would have "is copy" semantics, so the default @_ should. Reference: http://irclog.perlgeek.de/perl6/2015-11-12#i_11527317 Codified the ruling in the spectests in S06-signature/unspecified.t. /jnthn |
@jnthn - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#71112 (status was 'resolved')
Searchable as RT71112$
The text was updated successfully, but these errors were encountered: