| Summary: | [xtend] Support final field declarations | ||
|---|---|---|---|
| Product: | [Tools] Xtend | Reporter: | Sebastian Zarnekow <sebastian.zarnekow> |
| Component: | Core | Assignee: | Project Inbox <xtend-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | consiliens, harshad.rj, sven.efftinge, thsoft |
| Version: | 2.2.0 | Flags: | sebastian.zarnekow:
juno+
|
| Target Milestone: | M7 | ||
| Hardware: | PC | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
|
Description
Sebastian Zarnekow
Immutable fields are ubiquitous in the functional, composition-oriented programming style which Xtend itself encourages. (For some arguments, see http://javarizon.wordpress.com/2010/06/26/why-every-java-field-should-have-been-final-by-default among many others.) I know Xtend's design principle is to stay as close to Java as possible, but I'd propose, if it's already unfortunately not part of the language by design, to make it as easy to declare as possible (e.g. use another keyword like 'const' which is shorter and doesn't overload the other meanings of the final keyword). Proposed syntax:
class Person {
val myNumber = 42 // final
var foo = "default" // non-final
String anotherFoo = "default" // non-final
static val MY_CONSTANT = "foo bar baz"
var String name
}
*** Bug 371958 has been marked as a duplicate of this bug. *** pushed to master Requested via bug 522520. -M. |