January 2020
Intermediate to advanced
532 pages
13h 31m
English
You may wonder how it would ever be worth the effort to write so much code just to forward the method calls to the parent object. Indeed, the forwarding methods serve no purpose other than passing the exact same arguments to the parent. If programmers were paid by lines of code, then this would be quite an expensive proposition, wouldn't it?
Fortunately, this kind of boilerplate code can be reduced greatly using macros. There are several open source solutions that can help with this situation. For demonstration purposes, we can utilize the @forward macro from the Lazy.jl package. Let's replace all the forwarding methods, as follows:
using Lazy: @forward# Forward assessors and functions@forward ...
Read now
Unlock full access