Hey @lyskov,
quick question: The Limitations of Binder mention that type casting operators operator T() are ignored. Looking at the implementation in Binder for operator overloads though, it seems thought that at least some common type conversions might be possible, by mapping for instance __bool__, __int__, __float__, __complex__, __str__ to their respective C++ equivalents? Unless I'm missing something, adding those to the map in Binder's cpp_python_operator might just already out of the box, or not?
Of course, custom types would not be supported, but I think at least for those common ones, it might make sense!
Edit: For __str__, there is already an overload in Binder when an operator << is defined for a class, so that might conflict. On the other hand, it seems that Binder does not generate any code that uses __repr__, so maybe that can be used for the operator << instead? Or just kept as overloads in Python as well, if that works?
Let me know what you think, and thanks
Lucas
Hey @lyskov,
quick question: The Limitations of Binder mention that type casting operators
operator T()are ignored. Looking at the implementation in Binder for operator overloads though, it seems thought that at least some common type conversions might be possible, by mapping for instance__bool__,__int__,__float__,__complex__,__str__to their respective C++ equivalents? Unless I'm missing something, adding those to the map in Binder'scpp_python_operatormight just already out of the box, or not?Of course, custom types would not be supported, but I think at least for those common ones, it might make sense!
Edit: For
__str__, there is already an overload in Binder when anoperator <<is defined for a class, so that might conflict. On the other hand, it seems that Binder does not generate any code that uses__repr__, so maybe that can be used for theoperator <<instead? Or just kept as overloads in Python as well, if that works?Let me know what you think, and thanks
Lucas