-->
without js -- (no class under p2js, and certainly not the low-level stuff)
include builtins/structs.e
function deep_copy_class(class c)
string name = get_struct_name(c)
class res = new(name)
sequence fields = get_struct_fields(c)
for i=1 to length(fields) do
string field = fields[i][1]
store_field(res,field,fetch_field(c,field,name),name)
end for
return res
end function
class T
private atom x
public atom y
procedure show()
printf(1,"This is T%d/%d\n",{x,y})
end procedure
end class
T t = new({1,2}),
s = deep_copy_class(t)
s.y = 3
t.show()
s.show()