News for hackers. Stuff that matters.
Re:“I'm basically giving myself a permanent vacation from be... by marcosdumay on Thursday July 12, 2018 @04:05PM (#17518172)
That's parametrized jumping. Pattern matching is parsing a structure with variables and filling those variables from a single structured value.

Python does that with tuples:

    a, b = b, a
But it just stops there. To be fair, I don't know how much power it would gain by going further either. Never made that question.
Re:“I'm basically giving myself a permanent vacation from be... by joshuamorton on Thursday July 12, 2018 @04:20PM (#17518289)
That is more commonly known as destructuring. (in python and javascript at least, as well as a few others iirc)

Pattern matching is normally (in functional languages like Scala and Haskell anyway) defined as a way of taking a union type and handling each one safely. It's a sort of functional alternative to polymorphism.

That is, polymorphic code

    class Dog(Animal):
        def make_noise(self):
            return "bork bork"

    class Duck(Animal):
        def make_noise(self):
            return "quack"
would, with pattern matching be (in pseudo haskell I hope)

    make_noise :: Animal -> str
    make_noise Duck = "quack"
    make_noise Dog = "bork bork"
In other words, in an oop style you delegate to the object that it implements all methods. Whereas with pattern matching you can have a type delegate to each of the functions that can operate on it to handle it correctly. (This explanation is a disservice to functional styles, its a lot more elegant than what I describe if you do it correctly).
Re:“I'm basically giving myself a permanent vacation from be... by idontpost on Thursday July 12, 2018 @11:34PM (#17520332)
So basically Clojure protocols? As in, multimethods that dispatch on the type of their first argument?
Re:“I'm basically giving myself a permanent vacation from be... by joshuamorton on Thursday July 12, 2018 @11:45PM (#17520390)
Except that assuming Animal is a sum type (kind of like an enum), the computer will complain.

So a maybe type (equivalent to an Optional) is simply a sum over just and nothing (the two components). If you fall to handle nothing, the program won't compile.

Animal would work the same way. Add "Cow" as an animal, and your program won't compile until everything sanely handles Cow.

So more like a switch case over a set of options where the compiler prevents you from forgetting any.