Skip to content

(Dart.next) RegExp should support a const constructor #27613

Open
@matanlurey

Description

@matanlurey

Too often in code reviews (just saw @lrhn's code review) we are instructing developers to avoid creating new RegExp('...') as a class-level or local field (I've even seen it in tight-loops!). Can the RegExp class support a const constructor that is canonicalized?

assert(identical(const RegExp('a-z'), const RegExp('a-z'));

(Even if the implementation for the VM is not-so, we'd like this in dart2js badly)

/cc @rakudrama

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.core-llibrary-coretype-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