request: add typedef bool Predicate<E>(E element)
to dart:core
#11186
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
closed-obsolete
Closed as the reported issue is no longer relevant
core-n
type-enhancement
A request for a change that isn't a bug
This issue was originally filed by ross.dart...@gmail.com
Dart SDK version 0.5.13.1_r23552
rationale:
We currently have the following typedef in 'dart:core':
typedef int Comparator<T>(T a, T b);
I'm proposing to add a symmetric companion:
typedef bool Predicate<E>(E element);
Many of the methods on
Iterable<E>
take atest
function of the form:bool test(E element)
I am not proposing to change these signatures to take a Predicate. What I am proposing, is to offer the typedef in
dart:core
so that I can store typed references to Functions that are used on Iterables. Keep the loose coupling, but don't require me to typedef my own Predicate type to stock these Function references.This would be symmetric to how
List.sort
takes anint compare(E a, E b)
yet the dartdoc refers to the usage as aComparator
.thanks,
The text was updated successfully, but these errors were encountered: