Composition and inheritance: the Julian way

Both @forward and @quasiabstract allow to implement reusing patterns. But what is the best pattern depends on the problem and the boundary conditions (i.e. if Alice and Bob talks to each other…).

Hence it makes sense to provide them in a single package to facilitate switch back and forth, and to provide a clear comparison of the approaches in the examples.

AFAIK, the @forward macro in ReusePatterns.jl is the only one which automatically forwads all the necessary methods.

I’m not sure you will gain anything operationally or in terms of performance. As I said several similar functionalities are provided by other packages.

The point is: do you simply want your code to work, or do you wish to follow a (hopefully) well thought approach (even if it doesn’t provide any practical advantage) ? In the former case you may choose any package you like. In the latter case I suggest you to give Reusepatterns.jl a try, and if you find some flaw in the reasoning please tell me. I’m way more interested in understanding how it should be done, rather than in the implementation itself.

1 Like