The key point here is the word just. For a simple example you’re definitely right. But for a real life application (such as wrapping a
DataFrame object as we discussd above) this implies redefining ~200 methods. Of course a few of these (namely all those returning a
DataFrame struct) have to be redefined anyway, but what remains is still quite a large number.
Of course this is feasible, either manually or through macros, but my first thought is that I should try to find an alternative method. This triggered all present discussion.
Yeah, clearly all what we say here applies only if a structure is involved.
Of course I don’t want to fight any train. I’m asking here because I recognize many here are as way more expert than me. Still: no one told me yes, you have to blindly forward those ~200 methods, and forget about inheritance.
Which is OK for me, but I didn’t saw this carved in stones, nor in the manual or in the discourse or anywhere else. Hence my doubt arose…
To answer @favba: in your proposal you are implementing the
set_age for both
Citizen, which is exactly what I wanted to avoid (the famous ~200 methods…). Regardless of macro usage: the methods are always there: they do nothing, they flood the dispatch table and they have to be compiled.