3 ms·
That's a nice example, though I would like it if Stefan had the discussion about templates inside of the slides to make that point really clear since that's whe
by ChrisRackauckas 7y ago
That's a nice example, though I would like it if Stefan had the discussion about templates inside of the slides to make that point really clear since that's where the key difference lies. With templates, you can make static code get generated for the different combinations, but it's still static. And it will only generate the combinations that it knows about. If you compile a shared library and ship this off, and then someone makes a new Pet type and calls that function from your shared library, it won't get a new templated call because the behavior is static and you didn't make this new variant. Multiple dispatch is inherently dynamic and always specializes, and it's a compiler optimization that it generates fast static code in Julia, though that's not necessitated by the feature itself.