Skip to content

Support pattern matching #21847

Closed
Closed
@DartBot

Description

@DartBot

This issue was originally filed by [email protected]


What steps will clearly show the issue / need for enhancement?

  1. Support of pattern matching (à la Scala/Ocaml/...)
  2. Add a match keyword
  3. Look at this POC https://code.google.com/p/dart-pattern-matching/

This answer sums up the advantages of having this (instead of just if/switch) http://stackoverflow.com/a/21355296/505810

Also this:

  • It Allows to match on any sort of data with a first-match policy
  • It meets a functional logic: each case statement returns a value and the whole match statement is virtually a function that returns the matching case value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).closed-duplicateClosed in favor of an existing reporttype-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