This blog post shows how one could use closures to implement public/private members.
I cannot understand why I can access for instance
get_age with the dot
newDuck("Bill").get_age(): I thought the only way to access it was to do the less readable
Can anyone explain it to me? Thank you.
It uses an implementation detail about the representation of closures, namely
But I think this is an implementation detail, and not part of the official API, so I would not rely on this.
The blog refers to a StackOverflow post that is working in Julia v0.5.
That’s not the question. Sure, it is working, and has been working fine since the beginning, I am just not sure it is part of the API and guaranteed for 1.x.
The devdocs documents internals, which can change.