| Summary: | [xtend] Create function should allow to explicitly define the return type | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Sebastian Zarnekow <sebastian.zarnekow> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | sven.efftinge |
| Version: | 2.0.0 | Flags: | sebastian.zarnekow:
indigo+
|
| Target Milestone: | RC1 | ||
| Hardware: | PC | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
+1 for
MyType create result: newTypeImpl(..) newMyType(String 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 |
Currently the return type is the actual type of the create expression. This may expose implementation detail. A workaround is to use a cast expression but that leads to a too generic type in the initializer expression. create MyType result: new MyTypeImpl() newMyType(String something) { result.setPropertyWhichIsNotInTheInterface(something); } This seems a little counter intuitive to me. Another option is: MyType create result: newTypeImpl(..) newMyType(String something) { .. } which would be more in line with the definition of other operations.