(phixonline)-->
with javascript_semantics
enum NAME, METHOD
procedure me_t()
puts(1,"I is a T\n")
end procedure
procedure me_s()
puts(1,"I is an S\n")
end procedure
type T(object o)
-- as o[METHOD] can be overidden, don't verify it (as in test for me_t)!
return sequence(o) and length(o)=2 and string(o[NAME]) and integer(o[METHOD])
end type
type S(T t)
return t[METHOD] = me_s
end type
S s = {"S",me_s}
T t = {"T",me_t}
call_proc(t[METHOD],{})
t = s
call_proc(t[METHOD],{})