Private states in Julia modules

The reverse: export would not change at all.

  1. export would imply public, as well as (via using) being added to the namespace
  2. public names would be available without any special syntax via qualification (<module>.<name>)
  3. any other names require the <module>..<name> qualification (of course, you can do const foo = SPJ..foo to avoid paying the sin tax more than once in your module :wink: )

The last part is what helps later on, when you are trying to find all the places that might be broken due to changes in internals, and also helps people remember that they are accessing something that might change in the future
(like using functions with the unsafe_ prefix, you know you are treading into deep waters).
That’s why I like the concept of a “sin tax”, it doesn’t prevent you from “sinning”, but you do know that you are breaking one of the (encapsulation) commandments.

2 Likes