import Object cint 
import Strpool Selector String Sstring Pstring cstring Integer

Abstract : set of Object := {}

counter : cint := 1

func alloc(self) -> Abstract
  result := Object.alloc(self)
  class_of(self) := `Abstract'
  hashval(self) := counter
  counter +:= 1

proc reclaim(self)
  Object.reclaim(self)

func Mkstr(self) -> String
  result := alloc(new(Sstring), cstring.int2str(hashval(self)))
  Dec_ref(self)
!  return alloc(new(Pstring), inc_ref(`Abstract'), result)

func Set_attribute(self, aname, aval) -> Object
  OpAssign(Make_selector(aname, inc_ref(self)), aval, 0)
  return self
