Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

autrijus (1505)

autrijus
  (email not shown publicly)
http://pugs.blogs.com/

Journal of autrijus (1505)

Tuesday May 10, 2005
07:40 PM

Day 100: OO support landed!

[ #24620 ]
Breaking news -- This now works in Pugs:

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

Read-write accessors, alternate invocant names (e.g. method foo($self:)), automatic topicalizing etc all works, too.

Juerd reported that the slurpy context was implicitly flattening its arguments; that is clearly a Bad Thing. It's now fixed.

Larry decided to change $0 to mean the first captured match, to agree with $/[0], and avoiding massive off-by-one errors in the future. It's now implemented in Pugs -- instantly breaking lots of tests and example code -- but iblech heroically repaired them within minutes.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • As usual, I'm quite impressed with what you've put together. I just wish I had more time to help :/

    • Ovid,

      I too thought I couldn't possibly help the Pugs project because between paying $work and buying a house, I don't have any free time.

      There are so many ways to help the Pugs project and it feels good to. Here are some ways:

      1. Advocacy
      2. Writing p6 tests - even simple ones
      3. Porting p5 code to p6 as examples
      4. Asking for a feature - sometimes people with time are just waiting for an idea
      5. Documenting
      6. Sharing thoughts and ideas - sometimes all you do is plant the seed, others water and care, a
      • Actually, I kicked off the examples/cookbook project and wrote the first few recipes. I also did a bit of work bringing CGI.pm up to speed and wrote the first conversion of HTML::Entities. I've definitely had my hand in, but right now, it's time that I lack, not motivation :/

        • Hope I didn't offend by implying that you were making excuses. My intention was only to show that there are many ways to contribute and every tiny little bit helps.

          Besides, you have 119 registered "fans" and an unknown amount of anonymous ones. Anyone looking at stuff you have written that doesn't already know about Pugs or autrijus's journal get to see my advocacy propaganda.

          I also am spreading the word at the Monastery

          http://perlmonks.org/index.pl?node_id=455979 [perlmonks.org]

          Cheers,
          L~R
          • No, you didn't offend. I just didn't know if you were aware of my prior involvement.

            Generally, in order for someone to offend me, they have to try :)