You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 31, 2020. It is now read-only.
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 ast.py. 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 Generator.java 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.
The text was updated successfully, but these errors were encountered:
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'sthrow
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
ast.py
. In the case of generatorthrow
method, the check below is added invisit_Attribute
:The
throw
will be converted tothrow_
method name defined in Generator.java 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.
The text was updated successfully, but these errors were encountered: