In the case of generics, the cost of leaving out even simple generics has a high cognitive load cost. I have no problem with taking it slow and conservative; that's a reasonable place for them. But the koans and zealous arguments against generics disrupt the design process.
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)
-
I agree with this model, but do you agree that you first have to mentally instantiate the function with types before you can mentally instantiate it with parameters?
- 4 more replies
New conversation -
-
-
I'm curious about what you mean by the latter. The former is sadly harder to fix for computability reasons.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
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.