You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like there to be a short-hand for (x) => x.foo.
Assuming a symbol other than # is used for tear offs, i.e. perhaps :, thus removing the conflict with symbols, then (x) => x.foo could then be written as :foo.
This is useful with map. i.e. list.map((x) => x.foo) becomes list.map(:foo).
Another possibility is # could still be used and symbols could be made callable, so that #foo is also equivalent to (x) => x.foo when passed as a function.
Full example:
classFoo {
Foo(this.bar);
int bar;
}
List<Foo> foos = [newFoo(1), newFoo(2), newFoo(3)];
// :bar is identical to (x) => x.barList<int> bars = foos.map(:bar); // [1, 2, 3]
The text was updated successfully, but these errors were encountered:
I'd like there to be a short-hand for
(x) => x.foo
.Assuming a symbol other than
#
is used for tear offs, i.e. perhaps:
, thus removing the conflict with symbols, then(x) => x.foo
could then be written as:foo
.This is useful with map. i.e.
list.map((x) => x.foo)
becomeslist.map(:foo)
.Another possibility is
#
could still be used and symbols could be made callable, so that#foo
is also equivalent to(x) => x.foo
when passed as a function.Full example:
The text was updated successfully, but these errors were encountered: