On Tue, Nov 04, 2008 at 10:28:26PM -0800, Chris Dolan wrote:
> I propose that Perl6Object get a fallback __get_string method that  
> returns simply the class name and a unique identifier (maybe a  
> pointer value).  

Now added in r32373.  Here's an example:

    $ cat x
    class Foo {
        method speak() { say 'hello' }
    }
    
    say Foo.new();
    
    $ ./parrot perl6.pbc x
    Foo<0xb73ac540>
    $

As an added bonus, per Synopsis 13 one can also define a 
C<Str> method in a class to specify how it stringifies:

    $ cat y
    class Bar {
        method Str() { return 'world' }
    }
    
    say "hello { Bar.new() }";
    $ ./parrot perl6.pbc x
    hello world
    $

Closing ticket.  Thanks!

Pm

Reply via email to