Skip to content
0:00 / 0:00

#julia#multipledispatch#genericprogramming

The Unreasonable Effectiveness of Multiple Dispatch | Stefan Karpinski | JuliaCon 2019

The Julia Programming Language

91K subscribers • 17 videos on Hallway

YouTube
  • Recommended by 12 people: 9 on Hacker News, 1 on Lobsters, 1 in engineering communities and 1 curated list.
  • Presented by Stefan Karpinski, co-creator of Julia
  • An opinion. It argues one side of a question engineers disagree on.

Intermediate. Assumes working knowledge.

79K views7 years ago12 recommendations

Programming languagesSoftware designLanguage design and type systemsDesign patternsSoftware architecture

Stefan Karpinski explains how multiple dispatch enables unprecedented code reuse and interoperability between independent packages in Julia.

If you're familiar with Julia and its ecosystem, you may have noticed something lovely but a bit puzzling: there seems to be an unusually large amount of code reuse between packages compared to other seemingly similar languages. This sharing of code comes in two forms: 1. Sharing basic types among a wide variety of packages providing disparate functionality; 2. Sharing generic algorithms that work on various implementations of common abstractions. Why does generic code in Julia "just work"? Why do Julia packages seem to share types with so little friction? Both kinds of reuse are supposed to be natural benefits of class-based object-oriented languages. After all, inheritance and encapsulation are two of the four pillars of OOP. Even more puzzling is that Julia has no encapsulation and doesn't allow inheriting from concrete types at all. Yet both kinds of code reuse are rampant. What is going on? In this talk, I make the case that both of kinds sharing stem directly from Julia's multiple dispatch programming paradigm.

Why it's here

12 people recommend this

What people say. Highly recommended as the definitive explanation of multiple dispatch and why it makes Julia uniquely composable.

Moments people linked to

u/oilshellin r/ProgrammingLanguages • Recommends

JuliaCon 2019 | The Unreasonable Effectiveness of Multiple Dispatch | Stefan Karpinski

dTalon Hacker News • Recommends

On “JuliaCon 2020 Goes Online”

Did you mean "unreasonable effectiveness"? :P I just watched that talk the other day, and boy is it insightful. Julia has cracked a fairly magical combination of features. I fully expect it to replace Python over the next 10 years. Direct link to "Unreasonable Effectiveness": link to this video

andycon Lobsters • Recommends

The Unreasonable Effectiveness of Multiple Dispatch (JuliaCon 2019)

programming-talkscurated list on GitHubRecommends

Under “Julia”

The Unreasonable Effectiveness of Multiple Dispatch 00:35:23 by **Stefan Karpinski** (2019)

ddragonon Hacker News • Recommends

On “Julia library for fast machine learning”

…y, for example if you use a complex number type/library it will change the basic operators to deal with both real and imaginary parts, and if you use the GPU types within it, then it will do complex math in the GPU (and ML on complex math on GPU..., without any of the libraries being aware of the other). You can see a more detailed explanation on: link to this video…

ssivarkon Hacker News • Recommends

On “Multiple Dispatch in Julia”

You might also enjoy Stefan Karpinski’s talk at JuliaCon 2019 about how multiple dispatch helps make the language more expressive (than OOP, for Eg). The unreasonable effectiveness of multiple dispatch link to this video It seems like such an elegant idea, I’m somewhat surprised no one seems to have run with it earlier.

nur0non Hacker News • Recommends

On “Ask HN: What is your favorite YouTube channel to learn advanced programming?”

I like to watch talks by programming language designers. Some that readily come to mind are Rich Hickey, Joe Armstrong (RIP), and Stefan Karpinski. Some of my favorites are: - Simple Made Easy (Hickey): link - The Mess We're In (Armstrong): link - The Unreasonable Effectiveness of Multiple Dispatch (Karpinski): link to this video

StefanKarpinskion Hacker News • Recommends

On “The Accelerating Adoption of Julia”

…ation is that methods go inside of the type instead of being added externally. That means everyone has to agree on what methods can be called on a class or they have to subtype it, which sounds harmless, but is actually a big problem when what you really wanted to do was just define a new method for an existing type. My best attempt at explaining: link to this video There's also the issue that one sometimes needs to specialize generic operations in generic algorithms on something other than the receiver—sometimes even on more than one of the arguments. Single dispatch forces you to use something slow and awkward like double dispatch in cases like this. And that's assuming the person who wrote the gener…

amkkmaon Hacker News • Recommends

On “The Accelerating Adoption of Julia”

What? I used to write python, and to me, MD is first and foremost a conceptual improvement. Makes writing code so much sweeter, more expressive and sensical. It also heavily improves composability. It's LESS performant if not done carefully. Certainly FastAI, Matt rocklin etc didn't reimplement a subset in python just to get slower code See link to this video

stabbleson Hacker News • Recommends

On “Why Does Julia Work So Well?”

"The Unreasonable Effectiveness of X" is a reference to the well-known 'the unreasonable effectiveness of mathematics in the natural sciences'. It's turned into some sort of meme. Maybe you've seen 'the unreasonable effectiveness of recurrent neural networks' before. What you were referring to is a talk by a core developer at JuliaCon 2019 titled 'The unreasonable effectiveness of multiple dispatch' 1, which has less of a fanboy-vibe imho. Edit: Oh. I didn't notice the arstechnica article had this exact title. That's a bit cheap... 1 link to this video

dandanuaon Hacker News • Recommends

On “Quick Overview of Julia language [pdf]”

Indeed, Julia's abstract type system with multiple dispatch is its killer feature. It enables generic programming in a beautiful and concise fashion. Here 1 Stefan Karpinski gives some explanations of why multiple dispatch is so effective. 1 link to this video

krastanovon Hacker News • Recommends

On “Julia 1.6: what has changed since Julia 1.0?”

Julia's model is based around multimethods, which enables pretty crazy levels of interoperability (imagine being able to use scipy and tensorflow together, with tensorflow's autograd just magically working on most of scipy's functions). More about it here link to this video

u/Felix9876543210in r/ProgrammingLanguages • Mentions

Multiple Dispatch Ambiguities Do you know "multiple dispatch"? It's when the compiler or interpreter decides which concrete method to call, based on the *dynamic/runtime type* of *all* arguments. Most object oriented languages have single dispatch. That means that the concrete method called (I don't know if that's the correct term) depends on the dynamic type of the caller-object -- the one before the dot -- and just the *static types* of the other, normal, arguments. I came across multiple dispatch when I wanted to create some type of Asteriods game where different shapes are flying across the screen and different things happen when they collide, depending on their types (and whether the…

u/codesectionsin r/ProgrammingLanguages • Mentions

On “Sigils are an underappreciated programming technology”

We might be talking past each others somehow; sorry about that. I say that because several of the things you're saying are true in Julia are also true in Raku, and I'm confused about why you believe that they aren't. (Side note, Julia seems like one of the most Raku-like languages out there (not in the sense of being inspired by it, just convergent evolution). It's almost like Julia is the language you'd get if you started with the same sensibilities as Raku, but dialed down the value on expressiveness a little, and dialed up the value on performance, especially for science/math. > In Julia, the splat is more versatile so I can write add(1,2,3...,4,5,6...) to give me 21 (obviously I…

u/tobegain r/ProgrammingLanguages • Mentions

On “What’s your opinion on method overloading?”

See [video about the super-crazy overloading multiple dispatch of Julia. It is magic when it works as expected. Very confusing when it doesn't. In my language I chose explicit pattern-matching instead of implicit overloading.

sgt101on Hacker News • Mentions

On “Why do we need modules at all? (2011)”

Hello Julia - and it's unreasonably effective multiple dispatch system. link to this video f(x1,x2){} < x1.f(x2){x1} < f(x1,x2){x1,x2} But modules are useful for organising code and choosing what to bother the compiler with.