Support expression body definitions
Submitted by Adam Stark
Link to original bug (#727553)
Description
Dart (another language in the C#/Java/Vala syntax family) has a piece of syntactic sugar that I like.
int _cancelTimerLoopAnimationFrame () => __timerLoopAnimationFrame.cancel ();
which expands to.
int _cancelTimerLoopAnimationFrame () {
return __timerLoopAnimationFrame.cancel ();
}
It's a pretty simple syntactic change, and totally backward compatible. It's explained here https://www.dartlang.org/dart-tips/dart-tips-ep-6.html
It could be particularly handy for wrapped classes like this
class WrappedArrayList<T> : GLib.Object, Gee.Iterable, Gee.Traversable {
private Gee.ArrayList<T> values;
public WrappedArrayList() {
values = new Gee.ArrayList<T> ();
}
public override Iterator<T> iterator () => values.iterator ();
public override bool @foreach (ForallFunc<T> f) => values.foreach (f);
}
Edited by Rico Tzschichholz