Has this been discussed before?
I'm imagining these two classes are behaviorally the exact same:
class Renderer extends Component {
@cached
get result() {
return compileHBS(this.args.input;
}
get component () {
return this.result.component;
}
get error() {
return this.result.error;
}
get name() {
return this.result.name;
}
}
and
class Renderer extends Component {
// syntax tbd, prior art: Svelte
// though they start a line with $: to have this meaning
@cached result := compileHBS(this.args.input);
component := this.result.component;
error := this.result.error;
name := this.result.name;
}
The main benefit is primarily for what-would-be-one-line getters, which provides a way to define aliases for other data in way that doesn't get burned into the class instance, like a normal property would
class Renderer extends Component {
// set once, never references this.result ever again
component = this.result.component;
}
using getters allows us to reference component
on this.result
every time the getter is accessed.. it would be great to have a shorthand for this :)
thoughts?