I remember in Julia they called this multiple dispatch
-
-
-
Ah, so that's something different! Dynamic dispatch is when there's multiple arguments that fit a trait implementation, and during Runtime it's chosen which one to write too. This is marked with `dyn` in Rust. The thing I'm talking about is (I think) only a compile-time thing.
- 11 more replies
New conversation -
-
-
so instead of fn foo() { if condition { // ... } else { // ... } } it's a compile-time thing, like: #[cfg(condition)] fn foo() { /* ... */ } #[cfg(not-condition)] fn foo() { /* ... */ }
-
like how
#ifdef is used in C? - 3 more replies
New conversation -
-
-
Yay! had a shower thought this morning: if we have `copy_into` for arbitrary streams methods, then through specialization we could apply all sorts of fun optimizations such as https://linux.die.net/man/2/sendfile :D
- 3 more replies
New conversation -
-
This Tweet is unavailable.
-
Oh, it wasn't rethorical; I'm genuinely unsure what is and isn't specialization, and how far it can be taken.
End of conversation
-
-
-
The use case for me is repeat operations. First operation do it like this because a thing is not in memory; repeat operations like that because we can take advantage of memory. But in any case: this is the area of code-magic and generally speaking magic is a bad idea.
-
This is the same place I've thought I've wanted specialization: I have a trait with a blanket impl for [T], and I'd like to add a better performing blanket impl, but it only works on [T] where T: Copy
End of conversation
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.