Feature Request - Chainable Variable Setters

Topics: Language Specification
Oct 16, 2013 at 2:16 PM
Possibly another reserved word available in constructors that creates a method to accept the variables value and returns the object itself.

e.g.
class Chained {
constructor(public chainable required: boolean= false, public chainable disabled: boolean = false) {
}
}

would lead to

new Chained().Required(true).Disabled(true);
Coordinator
Oct 17, 2013 at 6:00 PM
Assuming I understand your suggestion, my immediate thought is that's harder to read than the expanded version:
class Chained {
   constructor() { }
   Required(b = false) : Chained {...}
   Disabled(b = false) : Chained {...} 
}
Chaining like that seems like a "nice to have", but perhaps a bit of a corner case to add it to the language.