Allowing the object.method(args...) syntax as an alias for method(object, args ...)

This has nothing to do with OOP per se. It sounds like you just want a namespace with “private” identifiers (e.g. private fields, private methods). This could certainly be implemented in Julia, and has been discussed multiple times — see this document and links therein.

It could even be accomplished to some degree without any language changes, e.g. as demonstrated in the PrivateModules.jl package or in this discussion.

In practice, it seems like none of these proposals have caught on very much, for reasons that have nothing to do with OOP vs. multiple dispatch. When you want to mark something as private and simply not documenting it seems insufficient, people often begin the identifier with an underscore. The compiler still doesn’t enforce anything, but if someone calls MyModule._some_internal_function(...) they are clearly doing so at their own risk, and this could easily be checked for automatically by linting tools.

5 Likes