3 ms·
Why don't languages who need pattern matching use Unification? Turing-complete pattern matching, with known fast implementations. Why does everyone need to rei
by YeGoblynQueenne 3y ago
Why don't languages who need pattern matching use Unification? Turing-complete pattern matching, with known fast implementations. Why does everyone need to reinvent the wheel ad-hoc, and end up with a square wheel that only rolls on Tuesdays?
https://en.wikipedia.org/wiki/Unification_(computer_science)#Syntactic_unification_of_first-order_terms https://en.wikipedia.org/wiki/Unification_(computer_science)...
- bwestergard 3y agoWouldn't it be highly undesirable to run a Turing complete unification process at the value level at run time?
- YeGoblynQueenne 3y agoAre you concerned about cost? There are linear-time and space algorithms for unification and they are algorithms (i.e. guaranteed to terminate).
- marcosdumay 3y agoRust is all about zero-cost abstractions. Linear time and space ones do not fit the bill. Some language willing to trade a bit of speed for expressivity could adopt it. But not Rust.
- saagarjha 3y agoBecause people have other goals. Doing Turing-complete pattern matching may not be desired, or someone might want something even more powerful (…or just different) than this.
- Ar-Curunir 3y agoRust gives you strong guarantees about exhaustive matching. If you had a Turing complete mechanism, it could not provide such strong guarantees.