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
Indexing an undef value halts a program in Rakudo instead of just giving a warning #282
Comments
From @masakr30537: Compare Perl 5: $ perl -Mstrict -we '$_{'a'}{'b'}; print "Alive!\n"' |
From @pmichaudOn Tue, Aug 26, 2008 at 01:28:22AM -0700, Carl Mäsak wrote:
The Perl 5 comparison really isn't applicable here. In Perl 5, $ perl -Mstrict -we '$_; print "Alive!\n"' So, let's look at what is happening in Rakudo. In Perl 6, I completely agree that Rakudo needs a better exception So, I'll leave this ticket as open until we get an Thanks! Pm |
The RT System itself - Status changed from 'new' to 'open' |
From @moritzPatrick R. Michaud wrote:
Your analysis is certainly right in this case, but note that it doesn't
As opposed to Perl 5, the second example should not autovivify %h<a> in Autovivification will only happen if the vivifiable path is bound to a And later on brings an example: # This is Perl 5 code In Perl 6 these read-only operations are indeed non-destructive: my %hash; I think that's very clearly not what is implemented at the moment ;-) -- |
From @cokeOn Tue Aug 26 01:28:22 2008, masak wrote:
With an Atlanta-era Rakudo, this now prints: $ ./perl6 -e '$/<a><b>; say "Alive!"' Assigning to moritz++ for testing, though I /think/ this might already -- |
From @cokeEr, that variable used in the original post is more magical than most. $ ./perl6 -e '$Q<a><b>; say "Alive!"' This seems to satisfy the original request, though, in that perl 6 is -- |
From @kylehaThis is an automatically generated mail to inform you that tests are now available in t/spec/S02-builtin_data_types/array.t commit 062319f3e4bbfa3cd2a051ed4a96dd0f537d07da [t/spec] test that .[] is defined oin Any, and .[0] returns self for scalars. Tests RT #58372 Inline Patchdiff --git a/t/spec/S02-builtin_data_types/array.t b/t/spec/S02-builtin_data_types/array.t
index 7f38341..6a7752d 100644
--- a/t/spec/S02-builtin_data_types/array.t
+++ b/t/spec/S02-builtin_data_types/array.t
@@ -2,7 +2,7 @@ use v6;
use Test;
-plan 96;
+plan *;
#L<S02/Mutable types/Array>
@@ -329,4 +329,17 @@ my @array2 = ("test", 1, Mu);
is [][].elems, 0, '[][] returns empty list/array';
}
+# RT #58372
+# by current group understanding of #perl6, postcircumifx:<[ ]> is actually
+# defined in Any, so that .[0] is the identity operation for non-Positional
+# types
+{
+ is 1[0], 1, '.[0] is identiity operation for scalars (Int)';
+ is 'abc'[0], 'abc', '.[0] is identiity operation for scalars (Str)';
+ nok 'abc'[1].defined, '.[1] on a scalar is not defined';
+ dies_ok { Mu.[0] }, 'but Mu has no .[]';
+}
+
+done_testing;
+
# vim: ft=perl6 |
@moritz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#58372 (status was 'resolved')
Searchable as RT58372$
The text was updated successfully, but these errors were encountered: