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

Don't restrict specifications to PDF manual #508

Closed
wants to merge 1 commit into from

Conversation

yihui
Copy link
Contributor

@yihui yihui commented Mar 17, 2025

This PR is not super important. I was just wondering if there was a reason that the function specifications were hidden from the HTML help pages. If this was intentional, please feel free to close the PR.

@yihui
Copy link
Contributor Author

yihui commented Mar 17, 2025

Closing the PR since I learned that the specifications were primarily for developers and not intended for end users. The original idea was probably from Yilong.

@yihui yihui closed this Mar 17, 2025
@jdblischak
Copy link
Collaborator

Adding some extra context, since I had the same suggestion recently.

I recently recommended that the documentation be updated to better distinguish the gs_design_X() functions from the gs_method_X() functions (#500). I had suggested adding the specifications to the HTML docs, but as you also learned today, these developer-docs are too granular to be much help to end users. In fact, in #501, these developer-only docs were simply deleted.

@yihui
Copy link
Contributor Author

yihui commented Mar 18, 2025

I feel all these specs can be deleted, or changed to ordinary R comments instead of using roxygen docs. I doubt if anyone would ever open the PDF manual to read the specs.

@nanxstats
Copy link
Collaborator

I agree this section is weird to have... but maybe for a good reason. I think it was modeled after the proprietary documentation requirements from a legacy language to be as consistent as possible. @elong0527

@elong0527
Copy link
Collaborator

The motivation of those spec sections was to follow organization SOP for software development life cycle requirement.

@yihui
Copy link
Contributor Author

yihui commented Mar 20, 2025

@elong0527 Thanks for the explanation!

This may be an example of Chesterton's fence :) Anyway, if it's important to follow SOP here, I think it may make more sense to develop a special tool similar to roxygen2. That is, we move the specs into the code, mark them as special comments, e.g., comments starting with # - (^\\s*#\\s+-\\s+):

ahr <- function(...) {

  # - Validate if input enrollment rate contains stratum column.
  # - Validate if input enrollment rate contains total duration column.
  res <- pw_info(
    enroll_rate = enroll_rate,
    fail_rate = fail_rate,
    total_duration = total_duration,
    ratio = ratio)

  #> Compute the proportion in each group.
  setDT(res)
  ...
}

Then we can extract the specs for all functions and build a full specs doc for whomever interested in reading them. This should be straightforward to implement (perhaps an afternoon would be enough). Another benefit is that the specs are blended into specific blocks of source code and can help authors/contributors understand the purpose of the code better. In case we need to update the specs or code, we can update them together since they are close to each other.

@elong0527
Copy link
Collaborator

Agree that will be a much cleaner solution!

@nanxstats
Copy link
Collaborator

Nice discussions. I think we might have already implemented @yihui's proposal internally... 😅 Let me connect you with the code owner @BrianLang via email to see if it's possible to standardized it and build as open source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants