Since most objects have no other state and dependencies than the values in their variables, it would make sense to have this behaviour built into Pike in case there is no encoding method in the object.
Agreed, doing this by default would make a whole lot of sense as long as it was documented as such. I should add that my method only save _public_ variables which of course is not what you want if you use private variables for state (I designed that particular where they are used in this way to avoid having to deal with every single variable).
/ David Hedbor
Previous text:
2003-02-28 01:02: Subject: Save_Object
No, that is a topic that surfaces occasionally. The encode_value function in Pike can encode objects to strings that can be stored on disk, stored in databases, sent over the net etc. It however needs to have access to the program the object came from and it needs the object to have an encode method that the Codec can call. The encode method should transform all the internal states of the object to a "plain" data structure (int/float/string/array/mapping/multiset). Since most objects have no other state and dependencies than the values in their variables, it would make sense to have this behaviour built into Pike in case there is no encoding method in the object.
/ Martin Nilsson (har bott i google)