| Summary: | [Xbase] add another implicit variable name | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Sven Efftinge <sven.efftinge> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | Flags: | sven.efftinge:
indigo+
|
| Version: | 2.0.0 | ||
| Target Milestone: | SR2 | ||
| Hardware: | PC | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
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 |
It's often interesting to bind a variable to an implicit available name like 'this'. However it's problematic to shadow 'this', since then all the local functions and elements are no longer visible. In Xtend for instance none of the extension methods would work any longer, since they are all invoked on 'this'. Therefore we want to introduce a second implicit variable name 'it' which is the only variable name allowed to be shadowed anywhere, With that you are able to write the following Xtend code: def initialize(Person it) { name = "Horst" age = 64 }