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 …
-
-
Replying to @graydon_pub
ML-style generics are less complicated than Go interfaces. There is no reason for Go not to have generics.
3 replies 0 retweets 12 likes -
Replying to @pcwalton @graydon_pub
I think more languages should look at ML for a useful example of an incredibly restrictive generics system that's still powerful enough to do most of what you want it to. I think too many people are focused on extremely powerful systems to their detriment.
2 replies 0 retweets 6 likes -
Replying to @strega_nil @graydon_pub
Agreed! Too many people on both sides equate “generics” with “C++’s implementation of generics”. If I were designing Go, given the choice between interfaces and ML-style generics I would have chosen the latter.
1 reply 0 retweets 0 likes -
Replying to @pcwalton @graydon_pub
Link to learn ML generics? ML is harder to search for than even Go.
1 reply 0 retweets 0 likes -
1 reply 0 retweets 1 like
-
Replying to @strega_nil @schmichael and
I dunno, there are probably better resources if you want to get in depth, like, Types and Programming Languages, but that's a good overview.
1 reply 0 retweets 0 likes -
Yeah, I'm having a really hard time figuring out how this would look in Go... ...are there no online language docs for ML?
2 replies 0 retweets 0 likes -
Replying to @schmichael @graydon_pub
I’ll describe it in a tweet. Syntax: func Map<T,U>(array T[], f func(T) T) U[] { ... } == works on all types, panics if you compare closures < > <= >=, ditto There’s a builtin function func Hash<T>(obj T) u64 which can hash things. That’s it.
2 replies 0 retweets 0 likes
Oops, make that func Map<T,U>(array T[], f func(val T) U) U[]
-
-
Replying to @pcwalton @graydon_pub
What is array in this example and why isn't it implied by the [] on T? Likewise what does the val keyword denote?
1 reply 0 retweets 0 likes -
that's just Go syntax for parameters
2 replies 0 retweets 0 likes - 7 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.