Skip to content
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

Maps reserved Java keywords to Python built-in function/method call #827

BPYap opened this issue Jun 1, 2018 · 1 comment


None yet
1 participant
Copy link

commented Jun 1, 2018

Some built-in methods in Python has names that conflict with reserved keyword in Java. One example is Python's generator throw method vs Java's throw syntax.

The current approach is by renaming the method to something else in Java implementation and adding checks to convert the name during Attribute node traversal in In the case of generator throw method, the check below is added in visit_Attribute:

if node.attr == "throw":
    node.attr = "throw_"  # refer org.python.types.Generator._throw

The throw will be converted to throw_ method name defined in during transpilation.

As you can see, it is not very 'scalable', plus it lacks mechanism to standardize naming convention for converted name.

I spoken with @freakboy3742 just now and he suggested to have a dictionary to store mappings of reserved Java syntax to standardized Python's call name so that the transpiler can refer to it during transpilation.


This comment has been minimized.

Copy link
Contributor Author

commented Jul 13, 2018

Closing this. This can be achieved by defining name field in @org.python.Method decorator.

@BPYap BPYap closed this Jul 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.