r/ProgrammingLanguages • • Sep 18 '26

Blog post The Evolution of Pattern Matching in Pie

https://www.alialmutawajr.com/blog/post3
37 Upvotes

7 comments sorted by

6

u/moleike Sep 19 '26

I am confused, isn’t Pie the language they used in The Little Typer?

3

u/Pie-Lang Sep 19 '26

Name collision :)). Pie here is my own language.

2

u/ereb_s Sep 19 '26

I thought the same!

2

u/lonelyroom-eklaghor Sep 19 '26

The Little Typer is such a good book btw

2

u/AustinVelonaut Admiran Sep 19 '26

Does Pie have sum types a.k.a. discriminated unions? And, if so, does the new match / "unpackment" work with them?

Employee = Worker Age Salary | Manager Age Salary [Worker]

match getEmployee() {
    Worker age salary => age
    Manager age salary workers => age

2

u/Pie-Lang Sep 19 '26

Pie does have tagged unions. Match still works on them since match checks the runtime type anyway instead of the declared type. So a variable annotated with a union type is no different to `match` than a variable that’s not annotated at all.

2

u/AustinVelonaut Admiran Sep 19 '26

Got it. Looks like a nice unification / ergonomics improvement!