Church-encoding gives sum types. We don't need to get #GoLang to add syntax for sums. We need to get it to add parametric polymorphism.
-
-
Replying to @puffnfresh
I think
@golang explicitly doesn't want to add such things as monomorphization, parametric polymorphism, or generic programming at all. :-/1 reply 0 retweets 0 likes -
Replying to @jarrednicholls @golang
yeah. Very disappointing. People submit proposals for specific things like sum types, yet polymorphism is able to give same functionality :(
1 reply 0 retweets 0 likes -
Replying to @puffnfresh @golang
Indeed. I would just like to avoid dynamic dispatch in certain code, without extra effort. But I write
@rustlang instead in those cases :)1 reply 0 retweets 0 likes -
by dynamic dispatch you mean avoiding a virtual method table, right?
2 replies 0 retweets 0 likes -
I do. Of course I'd like the ergonomics of generic programming too. At same time I somewhat enjoy the simplicity...
1 reply 0 retweets 1 like -
how does Rust help with avoiding the virtual method table? When it sees a monomorphic instantiation, it automatically creates a static call?
3 replies 0 retweets 0 likes -
fn foo<T: Trait>(t: T) is always monomorphized and statically dispatched. fn foo(t: &Trait) generates a vtable and dynamically dispatched
1 reply 1 retweet 5 likes -
what tools do I have available if I want the same code to support both types?
2 replies 0 retweets 0 likes
You'd have to write two functions; it's not possible. We don't support overloading.
-
-
Replying to @rustlang @puffnfresh and
Hold on, doesn't T = &Trait imply that T: Trait?
0 replies 0 retweets 0 likesThanks. 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.