| Summary: | [Xbase] Introduce second implicit argument for feature calls | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Sven Efftinge <sven.efftinge> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P1 | CC: | sebastian.zarnekow |
| Version: | 2.0.1 | Flags: | sven.efftinge:
indigo+
|
| Target Milestone: | SR2 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
Concrete syntax: featureCall() possible resolutions (ordered): it.featureCall() this.featureCall() extension.featureCall() Static.featureCall() this.featureCall(it) extension.featureCall(it) Static.featureCall(it) ==================================== Concreate syntax: that.featureCall() possible resolutions (ordered): that.featureCall() this.featureCall(that) extension.featureCall(that) Static.featureCall(that) First shot pushed to master. There's still some remaining work for the feature / sugar precedencies. 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 |
Now that we allow having a second implicit variable, it makes even more sense to allow invocation of extension methods on 'this' and 'it'. This is especially interesting for Xtend. Example: class MyXtendClass { def prependHello(String myString) { 'Hello '+myString } def testExtensionMethods() { val it = 'World' // currently we have to write it.prependHello // it should be possible to omit the receiver prependHello // doesn't work at the moment } } Not that, if both 'this' and 'it' are compatible to the same extension method the implicit is bound to 'it'.