Heredoc issue in pugs.
#!/usr/bin/env pugs my $a = q:t /END/ test END; $a.perl.say; Above example works ok in pugs, But the problem is. From S02 Heredocs are no longer written with , but with an adverb on any other quote construct: print qq:to/END/; Give $amount to the man behind curtain number $curtain. END Which is correct?
Instance attributes collision
For perl 6, Array and Scalar are in different namespace. So, class A { has $.a; has @.a }; what will A.new.a return by default? An Error? or Scalar has a higher priority? Thanks, xinming
Is S05 correct?
Hmm, There are sevral appears in S05 which use = instead of - in a for loop. So, Is this a typo? eg: for @{$pairs} = $pair { say Key: $pair[0]; say Val: $pair[1]; } Thanks, Xinming
Is there a way to generate an object without new?
What I want to do, is a bit like... class A { has $.b; method show { $.b.say }; }; A( b = 5 ).show;` Thanks, Xinming
Need correction to S06
svnbot6 r6401 | iblech++ | *%slurpy_hashes exist :) svnbot6 r6401 | iblech++ | It uses the semantics of svnbot6 r6401 | iblech++ | http://www.nntp.perl.org/group/perl.perl6.language/22860, i.e. svnbot6 r6401 | iblech++ | sub foo (*%hash) {...}, foo(hash = {...}); # works svnbot6 r6401 | iblech++ | sub foo (*%hash) {...}, foo(hash = {...}, foo = bar); # dies in S06 List parameters section sub duplicate($n, *%flag, [EMAIL PROTECTED]) {...} duplicate(3, reverse = 1, collate = 0, 2, 3, 5, 7, 11, 14); duplicate(3, :reverse, :collate(0), 2, 3, 5, 7, 11, 14); # same Should the example changed to? sub duplicate($n, *%flag, [EMAIL PROTECTED]) {...} duplicate(3, flag = { reverse = 1, collate = 0 }, 2, 3, 5, 7, 11, 14); duplicate(3, flag = { :reverse, :collate(0) }, 2, 3, 5, 7, 11, 14); # same duplicate(3, flag = { reverse = 1 }, collate = 0, 2, 3, 5, 7, 11, 14); #error duplicate(3, flag = { :reverse }, :collate(0), 2, 3, 5, 7, 11 ); # error. Otherwise, I might confuse many newbie just like I do. Thanks, Xinming
Can a scalar be lazy ?
my( $s, $t ); $s = value t is $t; $t = xyz; print $s; in perl 5, it will give a warning, and won't do right thing. we have to use other way or eval '$s' before print to get a correct answer. So I wonder, If we can make $scalar lazy also. As array now is lazy by default. Even if making scalar lazy might cause problem sometimes, Is it possible to add a property which is like my $var is lazy; to handle these situation? Thanks, Xinming
What will happen if the attribute's names are the same but declared with different keyword?
class T { has $.a =1; my $.a=2; }; my T $o .= new; $o.a().say; What the result will be please? 1 or 2? Or an error? Thanks, Xinming