Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: improve copy-vs-view, mutability, and advanced API #225

Merged
merged 7 commits into from
May 7, 2022
Merged

Conversation

timholy
Copy link
Member

@timholy timholy commented May 5, 2022

@johnnychen94 is pioneering a move of StructArrays into JuliaImages and I was taking a look at the package. The documentation is quite good, but (as usual) can be even better, and so I thought I'd leverage my "newbie" status to do some good for the community.

This revision attempts to address the following perceived issues:

  • the current documentation doesn't seem to mention that different methods of creating a StructArray differ in whether they create a view or a copy
  • the issue above is conflated with mutability of the underlying structure. These are actually two separate issues and in my opinion should be disentangled.
  • the advanced API section could be more explicit about how the specializations modify the behavior of the created StructArray.

The advanced API section might need further revisions; I think the portion of the demo involving Location might simply be a bug in StructArrays, but I haven't delved deeply. In any case, meta_table(s) throws an error so the demo doesn't work.

This also uses doctests more heavily to make sure the demos actually work.

Would appreciate a review from @piever and/or @jlchan if possible.

timholy added 2 commits May 5, 2022 10:56
In the "counterintuitive" section, the documentation formerly mixed
together two concepts: mutable structs and the copying behavior when
constructing a StructArray from an Array-of-Structs. This commit
disentagles these concepts.
This PR increases the verbosity of the "advanced techniques" page of
the documentation. The intent to be more explicit about what
occurs with default behavior, and how customizations yield a different
outcome.

In some ways this is unfinished: the portion of these docs involving
`Location` may be a bug in StructArrays. I didn't touch this section
of the documentation.
@timholy timholy requested a review from piever May 5, 2022 16:12
@timholy timholy added the doc label May 5, 2022
@timholy
Copy link
Member Author

timholy commented May 5, 2022

Given changes in printing over time, I'd recommend we disable doctesting on Julia 1.3. Happy to make this change if others approve.(did it)

Also adds Julia 1.6LTS to the CI matrix.
Copy link
Contributor

@jlchan jlchan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @timholy! I really like the new docs on modifying struct fields, and the additional documentation of AOS storage is helpful. I just added two small suggestions.

docs/src/counterintuitive.md Outdated Show resolved Hide resolved
docs/src/index.md Outdated Show resolved Hide resolved
@johnnychen94
Copy link
Member

johnnychen94 commented May 5, 2022

I didn't realize that there was a docs when I created #199. Now the README and the docs are out of sync, I think we need to delete the README doc contents and leave a link to the hosted documentation site?

@timholy
Copy link
Member Author

timholy commented May 7, 2022

I think we need to delete the README doc contents and leave a link to the hosted documentation site?

Good idea. I can try to add your point to these docs too.

@timholy
Copy link
Member Author

timholy commented May 7, 2022

OK, I introduced the dims=... constructor in the introduction. I struggled to describe the "counterintuitive" behavior for reinterpret (i.e., #197) because to me it's not counterintuitive, so I left that part out. I also emptied the README and redirected readers to the stable documentation by default. (Developers should know how to access the dev documentation from the pulldown.)

@timholy timholy merged commit 8df58d8 into master May 7, 2022
@timholy timholy deleted the teh/docs branch May 7, 2022 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants