5 ms·
As an Erlang fan, I can definitely see myself falling into the NOT_FOUND trap. I frequently miss immutable data when working in Python; in general I’m conflict
by macintux 6y ago
As an Erlang fan, I can definitely see myself falling into the NOT_FOUND trap.
I frequently miss immutable data when working in Python; in general I’m conflicted about languages that retrofit functional programming features, because immutability is such a huge benefit.
- tannhaeuser 6y agoAs a Prolog fan, I'm conflicted about languages that retrofit logic programming features (such as pattern matching) because term unification is such a huge benefit ;)
- tobmlt 6y agoAs a guy who built an interval arithmetic constraint programming system, based on minikanren, in python for his PhD, I agree, unification is pretty sweet!
- JNRowe 6y agoOi, you can't leave us hanging like that! I'd really love to read it if you have a link, even more so after the extra paragraph in your HN bio.
- ihumanable 6y agoFun fact: erlang was originally implemented in prolog, its since been rewritten in C. Many of the features in the language were inspired by prolog.
- ledauphin 6y agoi'm not sure "immutable data" is precise as a complaint here - this is akin to the difference between `const` and `let` in Javascript, which has nothing to do with immutability of the data and everything to do with the immutability of a name binding. I do wish we had better first-class immutable data in Python, but that wouldn't help with the NOT_FOUND = 404 match val: case NOT_FOUND: ... scenario that everyone is (rightly) fixated on, because integers themselves are already immutable.
- macintux 6y agoTrue, I tend to conflate immutable bindings with immutable data. With Erlang, all bindings are immutable, which makes pattern matching more powerful (although it can lead to unexpected crashes on occasion).
- tom_mellior 6y ago> scenario that everyone is (rightly) fixated on Your "rightly" obviously varies, but this scenario is the poster child for enums, and you can match on enum members. The featured article has an example.