3 ms·
Python has pseudo interfaces via the typing module. Julia really has nothing resembling interfaces -- you just have to keep in your head all the methods that ar
by bobbylarrybobby 4y ago
Python has pseudo interfaces via the typing module. Julia really has nothing resembling interfaces -- you just have to keep in your head all the methods that are expected to exist for a given type. The closest thing are abstract classes, which are used exclusively for dispatch, but you can only have a single superclass so they don't compose like interfaces do.
- tomkwong 4y ago> you just have to keep in your head all the methods that are expected to exist for a given type. Technically, you don't need to keep that in your head :-) The general approach is to define generic functions and also write docs about how to extend those functions to satisfy interface requirements. Perhaps not too surprisingly, many of the Julia community people also want to have some official interface support directly from the language. Before that, several open-source projects were spawned to address that gap e.g. here is a shameless plug about my package: https://github.com/tk3369/BinaryTraits.jl https://github.com/tk3369/BinaryTraits.jl