3 ms·
Pattern matching enable an entirely new class of features that are too tedious and error prone to implement otherwise. Specifically, anything that has to do wit
by angelzen 5y ago
Pattern matching enable an entirely new class of features that are too tedious and error prone to implement otherwise. Specifically, anything that has to do with recursive structures. Are recursive structures useful? Perhaps, given that natural language is fundamentally based on recursive structures.
Apps designed pre ubiqutous pattern matching say little about whether pattern matching has good uses or not. More likely features alluding to pattern matching were culled early in the design process.
- benhoyt 5y agoI think it's a bit of a stretch to say that "anything that has to do with recursive structures" is too tedious to implement with without pattern matching. I've written my share of recursion in Python, and have written a number of recursive parsers and language interpreters in Go (which also doesn't have pattern matching). I didn't find it bad at all. That said, I think your overall point is interesting. Will this new feature in Python mean that Python is used for certain domains it wasn't previously? I have my doubts, partly because it's a fairly slow byte-code interpreted language, and that limits its usefulness (I've seen a number of compilers written in OCaml, for example, which has pattern matching, but is also fast).