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

handling __add__ and others via a means #33

Open
robertleeplummerjr opened this issue Sep 6, 2017 · 2 comments
Open

handling __add__ and others via a means #33

robertleeplummerjr opened this issue Sep 6, 2017 · 2 comments

Comments

@robertleeplummerjr
Copy link

Python supports operator overriding, js does not. Perhaps there is a way to achieve this using some means. Documentation comes to mind, maybe comments, what else could potentially be used?

@azazel75
Copy link
Collaborator

azazel75 commented Sep 8, 2017

Documentation? you mean some kind of comment?

@azazel75
Copy link
Collaborator

azazel75 commented Sep 8, 2017

Transcrypt marks the regions of code containing the aritmetic expressions so that the transpiler knows when to transform them so that any possible per-type override is taken into consideration.

The best thing to do though would be for the transpiler to recognize via type hints that a + b is an expression involving an intance of type A which has an __add__ method defined and automatically transpile it to a.__add__(b), but there's still much stuff to do before having that...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants