| Summary: | [Xtend] use extension (i.e. setter) methods for assignments | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Sven Efftinge <sven.efftinge> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | knut.wannheden, sebastian.zarnekow |
| Version: | 2.1.0 | Flags: | sven.efftinge:
indigo+
|
| Target Milestone: | SR2 | ||
| Hardware: | PC | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
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 Closing all bugs that were set to RESOLVED before Neon.0 |
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"