JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.59k stars 5.48k forks source link

Official stance on getproperty, setproperty! and propertynames and docs #27120

Closed mauro3 closed 6 years ago

mauro3 commented 6 years ago

It is a bit unclear to me whether those are now the standard way to access type-fields or not? Presumably yes, but then why are they not exported and why are getfield, setfield! and fieldnames still exported if they should not be used? A clear stance on the "official-ness" of those would be good. Maybe pre-0.7 would be good if exports are to be added/removed.

Once that is cleared-up, the docs need updating: They are missing adequate doc-strings and are almost fully absent from the manual. To cite @stevengj: "We really need more documentation on how to use this, explaining the arguments to getproperty, how to fall back to getfield, implications for performance and type stability, best practices...." https://github.com/JuliaLang/julia/pull/24960#discussion_r157478864

Also, other places, such as https://docs.julialang.org/en/latest/manual/types/#Composite-Types-1 need updating if "properties" are "official".

JeffBezanson commented 6 years ago

Yes, let's just export them.

mbauman commented 6 years ago

Triage is in agreement with Jeff here — they just need to be exported and documented.

stevengj commented 6 years ago

Added to the milestone since the export needs to be added before 0.7 release.

mauro3 commented 6 years ago

Maybe this could be kept open for the doc-part? But remove the 1.0 milestone.