Julia language co-creators, Jeff Bezanson and Stefan Karpinski, talk about something puzzling that has emerged over time in the Julia ecosystem: 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: Basic types shared among a wide variety of packages providing disparate functionality; Generic algorithms that work on wide variety of implementations of common abstractions. In other words, generic code “just works” and packages share types with little friction. Of course, both kinds of reuse are desirable and supposed to happen in all kinds of languages, but all too often we have failed to see this kind of code reuse materialize in language ecosystems. Why is this actually working in Julia? And why aren’t we seeing more of this kind of code reuse in class-based object-oriented languages? After all, inheritance and encapsulation are two of the “pillars” of OOP. More counterintuitive still, Julia has no enforced encapsulation and doesn’t allow inheriting from concrete types at all.
In this talk, we make the case that both of kinds sharing stem directly from Julia’s multiple dispatch paradigm. Frictionless sharing of types comes from the external nature of multiple dispatch: the source of many problems in class-based OOP is that methods have to live “inside of” classes. By associating methods with generic functions rather than the type of their first argument, multiple dispatch avoids many issues that prevent code sharing in class-based languages. Generic algorithms “just work” because the language chooses the right implementation of each generic function based on the actual runtime types of all its arguments. We believe that this is the kind of language feature that seems esoteric until one starts using it in earnest, after which, it becomes indispensable.
Thu 24 OctDisplayed time zone: Beirut change
16:00 - 17:30 | |||
16:00 45mTalk | Climate Change and Software 2.0 Rebase Alan Edelman MIT | ||
16:45 45mTalk | Unreasonable Effectiveness of Multiple Dispatch Rebase |