-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Labels
Milestone
Description
I wonder whether we should have a special metamethod for pickle? The assumption that tostring (object) will generate a string that can be passed to functional.eval doesn't even hold true for the objects we provide in stdlib.
Two options:
- Objects that can be pickled have a
__picklemetamethod (analogous to Python's__repr) that outputs a constructor for the object being pickled (including arequire "appropriate.module".constructor {args}rather than assuming"appropriate.module"is already loaded). - We have to be careful that
__tostringdoes double duty with the above.
I'm leaning heavily towards (1) because, among others, it makes a cannot pickle error easy to determine and produce.
Reactions are currently unavailable