Matches.js

Languages and libraries

javascript library

SHOW HN2012

96points
20comments
#228of 1,677 in 2012
Top 14%of 2012 by points

How HN took it

MixedNo clear lean

4 positive, 3 neutral or asking, 1 mixed, 2 critical, out of 10 comments about the project. Thread score +0.24.

Idea: 3 for, 0 againstDesign: 1 for, 2 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Makes overloading declarative and cleaner for maintenance

    From 1 comment
    • I didn't know I needed this until I saw it and had that A-HA moment when I realized how much cleaner this would make a lot of code. Instead of hiding away the logic in a bunch of…
      OmarIsmail on HN
  • Useful addition to JavaScript

    From 2 comments

Objections

  • Relies on object key order, which ECMAScript does not guarantee

    From 1 comment
    • Cool! Sucks that it has to be so stringly typed, but I can't see another alternative. One concern: "Each pattern will be tried in order until a match is found." As far as I know,…
      jpolitz on HN
  • Readability concerns in large JavaScript codebases

    From 2 comments
    • I've come across aspects of this functionality before in a couple of languages now, even psql, however looking at this JavaScript way of doing it, I have to question whether it…
      se85 on HN
    • Thanks, I misread the first time, made sense the second time! My mistake! I still have my doubts as to how readable such an approach like this would be in large JavaScript…
      se85 on HN
  • String-based patterns feel stringly typed

    From 1 comment
    • Cool! Sucks that it has to be so stringly typed, but I can't see another alternative. One concern: "Each pattern will be tried in order until a match is found." As far as I know,…
      jpolitz on HN

Requests

  • Support for CoffeeScript-style pattern matching

    From 1 comment
    • Something like this would make a great addition to CoffeeScript.
      danh on HN

Questions

  • What are applications of pattern matching?

    From 1 comment

Alternatives named

  • Multimethods via bilby.js

    From 1 comment
    • Sucks that it has to be so stringly typed, but I can't see another alternative. Multimethods would be an alternative to this type of ad-hoc polymorphism. I've encoded immutable…
      pufuwozu on HN
  • LiveScript implicit switch

    From 1 comment
    • Check out LiveScript's implicit switch syntax: http://gkz.github.com/LiveScript/#switch
      oscilloscope on HN
  • XRegExp

    From 1 comment
    • For those interested: XRegExp (http://xregexp.com) is also relevant. (Not a direct competitor to Matches.js, but has some nice features)
      pooriaazimi on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/4516576)