Community
Participate
Working Groups
given the following extension function: def void setFoo(MyObj it, String prefix) { ... } I'd like to call it using assignment syntax: val MyObj x = ... x.foo = "Hello World"
Would it make sense to also allow: val MyObj x = ... x.foos += "Hello World" for something like: def List<String> getFoos(MyObj it) { ... } or the JavaBeans addFoo() style?
Yes, but that should work already.
(In reply to comment #1) > or the JavaBeans addFoo() style? JavaBeans only use #add and #remove prefixes for listener registration. That's why we don't have any plans to support the #add prefix for sugared method invocation.
(In reply to comment #1) > val MyObj x = ... > x.foos += "Hello World" > > for something like: > > def List<String> getFoos(MyObj it) { > ... > } I added a test case for that example and for the variant that uses even more implicit variables: .. val MyObj it = .. foos += "Hello World" .. def List<String> getFoos(MyObj something) { .. }
Pushed to master.
Closing all bugs that were set to RESOLVED before Neon.0