Re: Adding methods to (existing) classes

2005-06-17 Thread Patrick R. Michaud
On Thu, Jun 16, 2005 at 10:50:37AM +0200, Leopold Toetsch wrote: > Patrick R. Michaud wrote: > >... I.e., I'd like to be able to do something along > >the lines of: > >[omitted] > That works fine if you s/findclass/find_type/ Excellent! For some reason I thought it didn't work for me even when I

Re: Adding methods to (existing) classes

2005-06-16 Thread Leopold Toetsch
Patrick R. Michaud wrote: ... I.e., I'd like to be able to do something along the lines of: .sub main @MAIN $P99 = newclass "Foo" $S0 = ".sub h @ANON\nprint \"Hello\"\n.end\n" $P0 = compreg "PIR" $P1 = compile $P0, $S0 store_global "Foo", "hello",

Adding methods to (existing) classes

2005-06-15 Thread Patrick R. Michaud
Given that I have a subroutine stored in a PMC, is there a way for me to add that subroutine as a method to an existing class? In other words, I know I can use to add the subroutine into the current namespace... .namespace [ "Foo" ] .sub main @MAIN $S0 = ".sub h @ANON\npr