Skip to content

Comparable Interface Should Include Comparison Operators #45

@DartBot

Description

@DartBot

This issue was originally filed by [email protected]


The comparable interface should require implementation of the comparison operators. Given that Dart allows operator overloading, it is far more intuitive to write something along the lines of...

String a = 'aaa';
String b = 'bbb';

if (a < b) {
    print ('Hooray for operators!');
}

...than:

String a = 'aaa';
String b = 'bbb';

if ( a.compareTo(b) < 0) {
    // Whatever else.
}

This is not a huge deal, but to borrow a phrase from the Haskell wiki, it lowers the "semantic gap between the programmer's intention and the language".

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.closed-not-plannedClosed as we don't intend to take action on the reported issuetype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions