New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new java printer #26522
base: master
Are you sure you want to change the base?
Add new java printer #26522
Conversation
✅ Hi, I am the SymPy bot. I'm here to help you write a release notes entry. Please read the guide on how to write release notes. Your release notes are in good order. Here is what the release notes will look like:
This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.13. Click here to see the pull request description that was parsed.
|
🟠Hi, I am the SymPy bot. I've noticed that some of your commits add or delete files. Since this is sometimes done unintentionally, I wanted to alert you about it. This is an experimental feature of SymPy Bot. If you have any feedback on it, please comment at sympy/sympy-bot#75. The following commits add new files: If these files were added/deleted on purpose, you can ignore this message. |
class JavascriptCodePrinter(CodePrinter): | ||
class AbstractJavaFamilyPrinter(CodePrinter): | ||
|
||
def _print_Pow(self, expr): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the only thing they have in common or is there more coming? It doesn't seem worth having a shard superclass for just one method.
Generally, Java and Javascript is not very common, shares nothing common in history, and maintained by different entities (Oracle and W3C), I think that you need to add comprehensive test cases. It's hard to believe that it can generate generally correct code for Java, unless we can read the outputs. |
I think it is wise to reuse the names of the math functions (which are the same between Javascript and Java I believe). It does not need to use a subclass (and it doesn't look like it's an abstract one? so that would need to be renamed anyhow). And yes, I think more tests are needed. Did you try to get the tests in test_algorithms to pass? (the choice of supported math functions lead me to believe that): sympy/sympy/codegen/tests/test_algorithms.py Line 136 in ab88a7d
If so, it would be great if we could test a full java compilation & execution on the CI-server (we already do this for C). We could duplicate the _print_Pow method, but I would be curious to see if we could even move that into |
References to other Issues or PRs
Brief description of what is fixed or changed
JavaScript looks supported. But there is no printer for Java.
Other comments
Release Notes