Sweet candy! I might actually be able to start executing some of my code! Will try any day now. -- Darren Duncan

At 8:48 AM +0800 5/11/05, Autrijus Tang wrote:
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/

Reply via email to