I won’t @ them but limiting expressivity in order to limit cognitive load and keep codebases approachable is a totally legitimate move in language design. I’d even say essential. It’s all about balance, and expressivity _does_ have tradeoffs.https://twitter.com/SeanTAllen/status/1036236006872305665 …
-
-
I can say what I was trying to say a little more strongly: I strongly agree that today's generic system sucks both in terms of noise burden AND in terms of how closely it matches programmer intuition about parameterized types and functions.
-
I think you could probably argue the same for functions - before someone gets an intuition for what [type] functions are, [type] functions are confusing. They don't actually seem that hard, especially if you remove all the complicated (implicit or explicit) interface stuff
-
I don't think so, at least for me. I know both concepts extremely well (to the point of having written both frameworks using the concepts and implementations of the concepts), and type parameters feel much harder to me.
-
Part of that is because when types feel "easy", it's possible to mentally elide them and focus on normal function execution. But type parameters require you to first run a "type interpreter" in your head to understand what you're looking at.
-
I think this is the explanation for why people have an intuition that parameters are existentials: it's much easier to avoid the "type interpreter" step when you think about them that way.
-
I think I (maybe like
@ubsanitizer) don't understand the mental model you're describing. I think about (and teach) type parameterization as a precise analogue of function parameterization. You have two similar things (functions, type defs), and you abstract by adding a parameter. -
Right, that's my mental model of type parameters. I know functions are really hard to "get" before you have the intuition; I imagine type parameters are the same way.
-
(but once you have that intuition, then you're fine)
- 5 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.