[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[IMP-dev] Decorators vs particles



The issue of functions taking Decorator objects, or Decorators objects as arguments vs Particle* and Particles keeps coming up. Mostly we currently are going for Decorator objects and Particles the moment which is reasonably practical, but odd. Taking decorators makes the docs better (since it is clear what is expected from the particles), but then you have to convert things back and forth everywhere.

One solution for this on the C++ side would be to:
- write all methods to take Decorator objects and Decorators. This makes the docs nice and doesn't require duplicating methods - allow implicit conversions from Particle* to Decorator objects (I currently disallowed it) - allow implicit conversions from Particles to Decorators (by making Decorators be something other than std::vector, which is easy enough)

Ben, can such be made to work on the python side too via typemaps? I had looked at doing implicit conversions at some point and couldn't quite figure out how to make it work.