Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request: add typedef bool Predicate<E>(E element) to dart:core #11186

Closed
DartBot opened this issue Jun 10, 2013 · 2 comments
Closed

request: add typedef bool Predicate<E>(E element) to dart:core #11186

DartBot opened this issue Jun 10, 2013 · 2 comments
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

Comments

@DartBot
Copy link

DartBot commented Jun 10, 2013

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&lt;E&gt; take a test 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 an int compare(E a, E b) yet the dartdoc refers to the usage as a Comparator.

thanks,

@kasperl
Copy link

kasperl commented Jun 11, 2013

Added Area-Library, Triaged labels.

@lrhn
Copy link
Member

lrhn commented Aug 19, 2013

Removed Type-Defect label.
Added Type-Enhancement label.

@DartBot DartBot added Type-Enhancement area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. labels Aug 19, 2013
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed priority-unassigned labels Feb 29, 2016
@lrhn lrhn added core-m and removed core-m labels Aug 11, 2017
@matanlurey matanlurey added the closed-obsolete Closed as the reported issue is no longer relevant label Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

6 participants