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

custom operators #24

Open
pablogrisafi1975 opened this issue Sep 28, 2014 · 1 comment
Open

custom operators #24

pablogrisafi1975 opened this issue Sep 28, 2014 · 1 comment

Comments

@pablogrisafi1975
Copy link

You are a genius! Thanks for your wonderful job!
What about defining custom operators? maybe not as flexible as Scala, when you can have the pope operator <+|:-) if you want. But I was thinking about the eq operator, so
a eq b means Object.equals(a, b). It allows you to skip null checks, keep the == for references, and it is nicer on the eye.

Also, one small thing, the example code is somehow wrong, map.get("qwe")==null is not the same as map.containsKey("qwe") unless map is null free.

(I was also going to ask about null handling with ?, but pretty much everything I want to ask is already written in 'ideas' file)

Again, incredible work!

@amelentev
Copy link
Owner

from #22: Adding new operators is very complicated. To do it we need to extend Java parser but oo-plugin only works after parsing (in annotation processing stage). There are no extension points before annotation processing in Java7 compiler.
But there is some support of plugins in Java8 compiler (-Xplugin). Maybe it is possible to extend parser there. More research needed.

About map["qwe"]. Yes. It is not the same. I just tried to fit more use cases in small example. The difference doesn't really matter for the example.
Thanks

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

No branches or pull requests

2 participants