4 ms·
Multiple dispatch and meta programming are both wonderful, irrespective of speed benefits. For example, compare linear algebra syntax in Julia with those in R
by celrod 8y ago
Multiple dispatch and meta programming are both wonderful, irrespective of speed benefits.
For example, compare linear algebra syntax in Julia with those in R and Python.
Plus, the flexibility of multiple dispatch applying equally well to any of your own types really makes it feel like you can do anything in Julia.
Metaprogramming, writing code that writes code, can take a while to get used to. But is extremely powerful.
A final point I will make is comparability of Julia code. If you want to for a Bayesian model or solve a differential equation in Julia, you can mix your own types and code and any generically written library code at will, and it will often just work.
In R, you're not likely to find that; your Stan code can't call R functions you've written or those from your favorite libraries.
- sametmax 8y agoMultiple dispach and meta programming are available in python as well. Although duck typing is usually a better solution and it's not really a killer feature to data analysts anyway. Compared to python, i'd say julia has the reputation for being generally faster for things you can't use numpy with, and you can more easily scale multiple cpu or machines.
- srean 8y agoBy metaprogramming in Python, do you mean using decorators ? If so that's a far cry from metaprogramming
- fanf2 8y agoMultiple dispatch has to be coded by hand in Python, it isn’t a feature of the language.
- sametmax 8y agoSorry you are right. We only have single dispatch built in. I never had the use case for more so I confused them.
- jahewson 8y agoPython 3.7 added the ability to use type annotations with the @functools.singledispatch decorator which lets you write functions in a multi-dispatch manner.
- malmaud 8y agoAs the name suggests, that lets you write functions in a single-dispatch manner. That is different from multiple-dispatch.