On Thu, Oct 30, 2008 at 08:03:17AM -0700, Ovid wrote:
> This code:
> 
>   class Point {
>       has $.x is rw;
>       has $.y is rw;
> 
>       method get_string () {
>           return "<$.x, $.y>";
>       }
>   }
> 
>   my Point $point .= new( :x<1.2>, :y<-3.7> );
>   say $point.x;
>   say $point;
> 
> Generates this output:
> 
>   1.2
>   get_string() not implemented in class 'Point'

Now fixed in r32373.  The "get_string() not implemented ..."
message actually comes from Parrot -- in Perl 6 we define
stringification using the C<Str> method (see S13):

  $ cat point.pl
  class Point {
      has $.x is rw;
      has $.y is rw;
  
      method Str() {
          return "<$.x, $.y>";
      }
  }
  
  my Point $point .= new( :x<1.2>, :y<-3.7> );
  say $point.x;
  say $point;
  
  $ ./parrot perl6.pbc point.pl
  1.2
  <1.2, -3.7>
  $

This problem was also addressed in RT #60350 (now resolved).

Hope this helps, and thanks!

Pm

Reply via email to