rule name { Larry | Matz | Guido }
rule project { Perl | Ruby | Python }
rule description { <name> \s does \s <project> }
'Larry does Perl' ~~ /<description>/; # true
'Larry does Java' ~~ /<description>/; # false
This too:
class Point {
has $.x;
has $.y;
method show () { say "Coordinate: ($.x, $.y)" }
method set ($x, $y) { $.x = $x; $.y = $y }
}
my $pt = Point.new(:x(10), :y(20));
$pt.show; # Coordinate: (10, 20)
my $pt2 = $pt.clone;
$pt.set(30, 40);
$pt.show; # Coordinate: (30, 40)
$pt2.show; # Coordinate: (10, 20)
say(($pt ~~ Point).perl); # bool:true
say(($pt ~~ Hash).perl); # bool::false
Pugs's Parrot codegen backend needs to be updated to reflect both of
them, but the basics are there. May the hackings commence. :)
Thanks,
/Autrijus/