# Pattern Matching Syntax

**URL:** <https://es.discourse.group/t/pattern-matching-syntax/307>\
**Category:** Research\
**Created:** [April 17, 2020, 8:05am UTC](https://es.discourse.group/t/pattern-matching-syntax/307 "2020-04-17T08:05:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![yulia](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/yulia/32/291_2.png) [@yulia](https://es.discourse.group/u/yulia)\
**Post date:** [April 17, 2020, 8:05am UTC](https://es.discourse.group/t/pattern-matching-syntax/307/1 "2020-04-17T08:05:24Z")

</div>

Proposal: [https://github.com/tc39/proposal-pattern-matching](https://github.com/tc39/proposal-pattern-matching)

Scope: needs to be defined

goal: identifying a syntax for pattern matching

Ongoing discussion: [https://github.com/tc39/proposal-pattern-matching/issues/149](https://github.com/tc39/proposal-pattern-matching/issues/149), [https://github.com/tc39/proposal-pattern-matching/issues/153](https://github.com/tc39/proposal-pattern-matching/issues/153), [https://github.com/tc39/proposal-pattern-matching/issues/160](https://github.com/tc39/proposal-pattern-matching/issues/160)

Pattern matching is an anticipated proposal and fixes some issues we have with switch statements. However the initially proposed syntax has a high cost on the syntax budget. There is room for exploration here.

---

<div class="post-metadata">

**Author:** ![ljharb](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/ljharb/32/8_2.png) [@ljharb](https://es.discourse.group/u/ljharb)\
**Post date:** [April 17, 2020, 8:16am UTC](https://es.discourse.group/t/pattern-matching-syntax/307/2 "2020-04-17T08:16:58Z")

</div>

Since I’ve just taken over championing this proposal, and the New champion group has not yet met, and the syntax is likely to change, it may be premature to explore things based on the initially proposed syntax (which has changed in the repo sine the presentation, significantly)

---

<div class="post-metadata">

**Author:** ![yulia](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/yulia/32/291_2.png) [@yulia](https://es.discourse.group/u/yulia)\
**Post date:** [April 17, 2020, 8:49am UTC](https://es.discourse.group/t/pattern-matching-syntax/307/3 "2020-04-17T08:49:55Z")

</div>

Thanks for the comment. Yes the syntax is likely to change substantially. If we want, we can use qualitative methods to identify important aspects to incorporate into the design. This is why the scope still needs to bee defined.

---

<div class="post-metadata">

**Author:** ![aleen42](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/aleen42/32/461_2.png) [@aleen42](https://es.discourse.group/u/aleen42)\
**Post date:** [April 20, 2021, 1:48am UTC](https://es.discourse.group/t/pattern-matching-syntax/307/4 "2021-04-20T01:48:14Z")

</div>

What is the difference between `caes-when` syntax and `switch-case` syntax? To support destructuring cases?

---

<div class="post-metadata">

**Author:** ![aclaymore](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/aclaymore/32/501_2.png) [@aclaymore](https://es.discourse.group/u/aclaymore)\
**Post date:** [April 20, 2021, 7:03am UTC](https://es.discourse.group/t/pattern-matching-syntax/307/5 "2021-04-20T07:03:03Z")

</div>

Another difference is that the `when`s don’t fall through to the next one. So don’t need to add `break`.

---

<div class="post-metadata">

**Author:** ![aleen42](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/aleen42/32/461_2.png) [@aleen42](https://es.discourse.group/u/aleen42)\
**Post date:** [April 20, 2021, 7:32am UTC](https://es.discourse.group/t/pattern-matching-syntax/307/6 "2021-04-20T07:32:06Z")

</div>

Yes, seems like a short-circuit.
