El dom., 14 abr. 2019 a las 22:27, yary (<not....@gmail.com>) escribió:

> Looks like perl6 semicolon has different meaning in a list vs a capture.
> In a list, it "makes sense to me"
>
> > perl6 --version
> This is Rakudo Star version 2018.10 built on MoarVM version 2018.10
> implementing Perl 6.c.
> >perl6
> To exit type 'exit' or '^D'
> > ('a').perl
> "a"
> > ('a';).perl
> "a"
> > ('a', 'b' ;).perl
> ("a", "b")
> > ('a', 'b' ; 'c').perl
> (("a", "b"), "c")
> > ('a', 'b' ; 'c' ;).perl
> (("a", "b"), "c")
> > ('a', 'b' ; 'c' ; ;).perl
> (("a", "b"), "c", Nil)
> > ('a', 'b' ; 'c' , ; ;).perl
> (("a", "b"), ("c",), Nil)
>
> - the rule "a single thing is a scalar, a single thing followed by a comma
> is a list" applies in the last example
>
> But there's inconsistency with captures.
>
> >\('a').perl
> \("a")
> > \('a';).perl; # Unexpected empty list at end
> \(("a",), ())
> > \('a', 'b' ;).perl; # Unexpected empty list at end
> \(("A", "b"), ())
> > \('a', 'b' ; 'c').perl; # unexpected "c" as list
> \(("a", "b"), ("c",))
> > \('a', 'b' ; 'c' ;).perl; # "c" as list, and empty list at end
> \(("a", "b"), ("c",), ())
> > \('a', 'b' ; 'c' ; ;).perl; # "c" as list, and 2 empty lists instead of
> single nil at end
> \(("a", "b"), ("c",), (), ())
> > \('a', 'b' ; 'c' , ; ;).perl; # 2 empty lists instead of single nil at
> end
> \(("a", "b"), ("c",), (), ())
>
> This cries for an explanation, or a bug report.
>


Would be nice if someone raised the issue in https://github.com/perl6/doc

Cheers

JJ

Reply via email to