Skip to content

string.pickle makes some bad assumptions #61

@gvvaughan

Description

@gvvaughan

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:

  1. Objects that can be pickled have a __pickle metamethod (analogous to Python's __repr) that outputs a constructor for the object being pickled (including a require "appropriate.module".constructor {args} rather than assuming "appropriate.module" is already loaded).
  2. We have to be careful that __tostring does 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions