1. 2

    It’s worth noting that JS has a pattern matching feature under consideration as well. https://github.com/tc39/proposal-pattern-matching

    1. 4

      So, story time then as far as how this all started.

      Fog City Ruby, Pat Shaughnessy was talking about FP in Ruby and lamenting that it didn’t really have pattern matching. Me and @havenwood were playing with some syntax after with case statements to try and make a psuedo-system on it and ended up writing this gist as a “proof of concept”:

      https://gist.github.com/baweaver/611389c41c9005d025fb8e55448bf5f5

      Afterwards we’d joked about maybe making it a gem, but I hadn’t quite thought it through. I saw @maybekatz tweet about pattern matching in JS (beginning of the proposal) not too long afterwards and thought why not? So I decided to make Qo and see how far I could push it.

      Qo was meant far more as a “what if” and proof of concept than a “do this” exactly. I wanted to use it as a catalyst for discussion on how Ruby could have pattern matching while retaining some of its own natural look and feel. After it was released I pushed hard to get it in front of people and spread the idea around to see if it took hold.

      Matz has said before that good language feature proposals start as gems of some sort and evolve, so that was the entire goal. Get them talking, give them ideas, and try and qualify all the concerns and nuances around it.

      The part I didn’t quite expect was Zverok posting the issue. As soon as that dropped I basically took all the notes and thoughts I had and dumped them into the issue, including references to the TC39 proposal that really got me started on it.

      So the short version of all of this is no, the timing was not an accident. This was the best time to try and get the issue brought up and get real attention to it, and it looks like we’re having some degree of success with it so far.

      1. 1

        I’m glad there’s back-and-forth among the language communities. Thank you for sharing.

    1. 5

      I’m working on a simple tower defense game, mainly to try apply a genetic algorithm to finding optimal build orders. I chose JS/HTML5 to make the results easy to distribute. (It feels like if it’s not on the web, no one will check it out.) I ran into a lot of little bugs because JS lacks strong types. The algorithm works fairly well, but taking up the CPU in a webpage doesn’t work too well. I might have to do the optimization in node and export to a JS/HTML5 viewer instead.

      1. 14

        I’m shocked that 1) they didn’t anticipate $1 donors getting angry at this change 2) the change wasn’t telegraphed ahead of time. How can a company change such a fundamental part of their business like this? I worry that their VC-funded business is going to result in all sorts of shenanigans once they have to start showing 10x returns on venture capital.

        1. 10

          Yup, my thoughts exactly. I’d like to see a co-op model where creators have control over company decisions and share in the profits.

          1. 3

            Yes! Something like the way Vanguard is structured. It’s a workable model for a company that commits to it.

          2. 10

            Wow, I had no idea Patreon was VC-funded. Talk about an oxymoron.

            1. 7

              It’s why I recommended against it. A lean nonprofit is best for that kind of thing.

          1. 8

            We didn’t make greater progress in physics over the 1950–2000 period than we did over 1900–1950 — we did, arguably, about as well. Mathematics is not advancing significantly faster today than it did in 1920. Medical science has been making linear progress on essentially all of its metrics, for decades.

            Basically, all his claims based on this assertion. And to my knowledge it is blatantly false. By themself, computer, internet and mobile phone are game changer. To my knowledge, the similar game changer were the invention of writing (4 millenia AD) printing (15th century) and so internet&co (20th century). the time lapse between the two first invention are 5.5 millenia and the time lapse between the two last invention are 5 century. As such, there was a factor 10 of improvement of discovery speed due to improvement in science. I would bet that exponential progress appear to original author as linear, because when you look any exponential curves close enough it always appear linear.

            1. 1

              A friend of mine’s who’s doing a PhD in English literature said they don’t give much weight to criticism before the 80s - they simply couldn’t synthesize as many sources as they can now with online databases.

            1. 15

              Reminds me of this quote about Niklaus Wirth, the creator of Pascal from this article by Michael Franz.

              And true to his quest for simplicity, Wirth continuously kept improving his compilers according to this metric, even if this meant throwing away a perfectly workable, albeit more complex solution. I still vividly remember the day that Wirth decided to replace the elegant data structure used in the compiler’s symbol table handler by a mundane linear list. In the original compiler, the objects in the symbol table had been sorted in a tree data structure (in identifier lexical order) for fast access, with a separate linear list representing their declaration order. One day Wirth decided that there really weren’t enough objects in a typical scope to make the sorted tree cost-effective. All of us Ph.D. students were horrified: it had taken time to implement the sorted tree, the solution was elegant, and it worked well – so why would one want to throw it away and replace it by something simpler, and even worse, something as prosaic as a linear list? But of course, Wirth was right, and the simplified compiler was both smaller and faster than its predecessor.

              1. 6

                Faulkner said: “In writing, you must kill your darlings.” Definitely applies to software too.

                1. 2

                  What do you mean by that in this case?

                  1. 3

                    I think he’s referring to excising little bits of “clever” code when their purpose could legitimately be handled with simpler code. Some complexity is warranted, other isn’t