sdvillal / whatami

Easily provide python objects with self-identification
Other
9 stars 1 forks source link

Implement configure or reconstruction #2

Open sdvillal opened 9 years ago

sdvillal commented 9 years ago

First of all, I still need to decide if this is a good idea.

whatami focus is on simple and consistent id string generation, but being able to regenerate the objects could be a plus. However, whenever this is done, it should impose no more API requirements to the whatamised objects, as we want whatami to stay simple, general accross many different libraries and unobtrusive for new libraries.

That means that reconstruction should be handled by external factories that know how to instantiate and configure the objects. For example, a factory could know how to map names to instantiation mechanism:

As usual, special care should be given to nested configurations.

sdvillal commented 9 years ago

A factory that maps id strings to objects, plus a mechanism where we can plug factories into WhatamiTreeVisitor, mapping names to concrete factories, would probably make the trick.