Pooh program example 08-object-prototype-finalizer.p
# test where object has a finalizer - it is called when object is freed.
a := { 'field' : 42, 
       'finalizer' : sub ()
                        println( ~msg 'finalizer is called' )
                     end
     }  
# assigning a different value to a; the previous value is now freed and finalizer is called.
a = {}
finalizer is calledTrace output for 08-object-prototype-finalizer.p
004|a := { 'field' : 42 , 'finalizer' : sub () } 005|sub () 006| println( ~msg 'finalizer is called' )... 005|end 013|a = { }