How do you indicate that a field should be private?

In C#/Java we can do so with the private keyword, in Python we can use the underscore. I found this discussion on Github, but it’s from 2015.

Is the accepted convention to use the underscore?

struct Example
    _this_field_is_private::Int32
     this_field_is_public::String
end 

Some people consider all fields private by default. See Documenting elements of a struct

2 Likes

That’s a pretty common convention in Julia, though by by no means universal.

3 Likes

There is also the option of defining propertynames(x :: Example, private :: Bool).

2 Likes