Sign In/My Account | View Cart  
advertisement


Listen Print

This week on Perl 6 (week ending 2002-07-21)
by Leon Brocard | Pages: 1, 2

RECALL

Tanton Gibbs posted a patch to clean up a problem with our Copy on Write strategy. He kindly explained it for me: "The basic problem is that in perlint.pmc we have something like:


  void set_string( PMC* value ) {
    CHANGE_TYPE( SELF, PerlString );
    SELF->data = value->data
  }

In other words implement a COW strategy after being changed into a PerlString. However, in perlstring.pmc the following is performed:


  void set_string( PMC* value ) {
    SELF->data = string_copy( INTERP, value->data );
  }

The RECALL command automates that so that set_string now looks like:


  void set_string( PMC* value ) {
    CHANGE_TYPE( pmc, PerlString );
    RECALL;
  }

Thanks to Tanton for explaining.

Internals misc

There were also lots of other small patches and discussions. It looks like the push for this week is to make it easier to add new PMCs to Parrot.

Meanwhile, in perl6-language

It was a quiet week in the perl6-language list, which is probably a good thing as thinking too much about hyper operators makes my head hurt.

Hyper operators

There was some discussion on hyper operators this week. It didn't go anywhere in particular, but discussed lots of syntax. Objections such as "this code looks ugly!" came up regularly when talking about code such as:


  @solution =  (^-@b + sqrt(@b^**2 ^+ 4^*@a^*@c) ) ^/ (2^*@a);

Luke Palmer pointed out that it might be better expressed as:


  for @a; @b; @c; @s is rw ->
    $a; $b; $c; $s {
      $s = (-$b + sqrt($b**2 - 4*$a*$c)) / (2*$a)
  }

Karl Glazebrook explained that PDL keeps everything as objects and does hyper operator magic without additional syntax. So Perl 6 "@y = $a ^* @x ^+ @b" happens in PDL with the clearer "$y = $a * $x + $b". Isn't PDL shiny?

Whitespace?

Brent Dax noticed that there might be a problem with the regular expression modifier ":w". The words modifier, according to Apocalypse 5 , "causes an implicit match of whitespace wherever there's literal whitespace in a pattern". He asked what the following expand to:


  m:w/foo [~|bar]/
  m:w/[~|bar] foo/
  m:w/[~|bar] [^|baz]/
  m:w/@foo @bar/

Luke Palmer expanded that "In other words, it replaces every sequence of actual whitespace in the pattern with a \s+ (between two identifiers) or a \s* (between anything else)". Thus, the first would expand to:


  m/ foo \s* [~ | bar] /

However, it's not easy to represent, as the later cases point out. He continues: "Perhaps :w wouldn't transform the rexex, but keep 'markers' on where there was whitespace in the regex". Nevertheless, it's a very useful feature.

Acknowledgements

This summary was brought to you from the O'Reilly Open Source conference and with the music from the intro to Buffy the Vampire Slayer.

As Piers says: Once again, if you liked this, then give money to YAS, if you didn't like it, well, then you can still give them money; maybe they'll use it to hire a better writer. Or maybe you could write a competing summary.