Ovid wrote: > This code: > > class Point { > has $.x is rw; > has $.y is rw; > > method get_string () {
The correct way to define user-defined stringfication is either through method Str { ... } or method prefix:<~> ($self: ) { ... } (afaict both are not implemented in Rakudo yet) Parrots concept of 'get_string' is on a different level (vtable stuff I think, but I don't grok the internals) and not accessible from Perl 6. > 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' I think that every class should have a default stringification. Dunno if there's a ticket for it yet. Cheers, Moritz -- Moritz Lenz http://perlgeek.de/ | http://perl-6.de/ | http://sudokugarden.de/