Named rules and basic OO support landed.

0 views
Skip to first unread message

Autrijus Tang

unread,
May 10, 2005, 8:48:08 PM5/10/05
to perl6-c...@perl.org
This works:

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/

Darren Duncan

unread,
May 11, 2005, 3:07:41 AM5/11/05
to perl6-c...@perl.org
Sweet candy! I might actually be able to start executing some of my
code! Will try any day now. -- Darren Duncan
Reply all
Reply to author
Forward
0 new messages