>
>
> @is_cpp_translatable
> class SomeClass(Basic):
> @staticvars({'a': 'int', 'b': 'int', 'c': 'double'})
> def simple_method(a, b):
> c = a // 2 + b // 3
> return c
>
>
Such decorators could undergo a first phase of testing, i.e. checking
during the execution of the tests that those variables are indeed of the
type declared in the dict.
After successful testing of the staticity of internal variables, one could
use some existing Python to C++ translators combined with the dict in order
to generate C++ code.
This solution would have the advantage that coding is required only once,
in Python with some precautions. C++ code would be always up to date with
any edits in the Python code.
I know that *numba* has a similar approach using decorators, except that it
compiles the code just-in-time, which is a bit different. I don't know if
there is any existing project applying something like a decorator-based
translator.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.