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
Using Perl6 PDF: Some subroutine examples don't work when declared before call #2069
Comments
From sohtil@gmail.comHi! A class declaration without C<;> at the end gives a confusing error Lithos $ cat test.pl This is Rakudo Perl 6, version 2010.07-115-g0839993 built on parrot 2.6.0 r48341 With a semicolon at the end of the first line it works: $ cat test.pl |
From @jkeenanThe New York City Rakudo Star study group is working its way through WORKS: use v6; orderbeer('Hobgoblin', 1); sub orderbeer($type, $pints) { FAILS: use v6; sub orderbeer($type, $pints) { orderbeer('Hobgoblin', 1); Error message ===SORRY!=== shell returned 1 On the other hand, other subroutines work regardless of whether they WORKS EITHER WAY: use v6; sub announce-time(:dinner($supper) = '8pm') { announce-time(dinner => '9pm'); Can you clarify? Thank you very much. |
From @pmichaudOn Sat, Aug 14, 2010 at 10:55:57AM -0700, James Keenan wrote:
The problem here is that Rakudo is mis-interpreting the "or" that Anyway, it's definitely a bug in Rakudo, and I'll try to fix it soon. Pm |
The RT System itself - Status changed from 'new' to 'open' |
From sohtil@gmail.comThe problem with sub orderbeer { looks similar to the problem I reported as #77208 class C { } which might be due to "module" starting with "mod". |
From sohtil@gmail.comSee also #77218 about a problem with sub orderbeer { that might have a similar cause. |
sohtil@gmail.com - Status changed from 'new' to 'open' |
From @kylehaThis is an automatically generated mail to inform you that tests are now available in t/spec/S02-names/identifier.t commit e4bce85a069b2b0af6fb9b71d719ebaf9f296b36 [t/spec] tests for RT #77218, identifiers that start with an operator name Inline Patchdiff --git a/t/spec/S02-names/identifier.t b/t/spec/S02-names/identifier.t
index 8bc9b52..60515e3 100644
--- a/t/spec/S02-names/identifier.t
+++ b/t/spec/S02-names/identifier.t
@@ -1,7 +1,7 @@
use v6;
use Test;
-plan 18;
+plan 20;
# L<S02/Names/An identifier is composed of an alphabetic character>
@@ -84,6 +84,25 @@ plan 18;
is my($x), 23, 'call to sub named "my" works';
}
+# RT #77218
+# Rakudo had troubles with identifiers whos prefix is an alphanumeric infix
+# operator; for example 'sub order' would fail because 'order' begins with
+# 'or'
+{
+ my $res;
+ sub order-beer($what) { $res = "a $what please!" };
+ order-beer('Pils');
+ is $res, 'a Pils please!',
+ 'can call subroutines whos name begin with an alphabetic infix (or)';
+
+ my $tempo;
+ sub andante() { $tempo = 'walking pace' }
+ andante;
+
+ is $tempo, 'walking pace',
+ 'can call subroutines whos name begin with an alphabetic infix (and)';
+}
+
done_testing;
# vim: ft=perl6 |
From @moritzThanks for the report, I've fixed the problem in Rakudo. |
@moritz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#77218 (status was 'resolved')
Searchable as RT77218$
The text was updated successfully, but these errors were encountered: