OpenMath / py-openmath

An OpenMath 2.0 implementation in Python
MIT License
15 stars 4 forks source link

Move conversion into a class #12

Closed florian-rabe closed 6 years ago

florian-rabe commented 6 years ago

The convert methods maintains global state, which is awkward.

The code should be wrapped into a class that encapsulates the state.

defeo commented 6 years ago

I do not think "awkwardness" is enough of a reason to rewrite a code that works and does exactly what it is asked for. Don't forget that the scope is local to the module, so I really don't see how wrapping into a class would improve things.

tkw1536 commented 6 years ago

I agree with @florian-rabe here, in that there is global state here where there should be none.

In particular, it is not possible to have two different conversions for the same OpenMath object registered. This essentially makes it impossible to use theconvert module as a dependency without having to worry about other modules using the same symbols already.

tkw1536 commented 6 years ago

Made PR #12 in an attempt to fix this issue.