Skip to content

Document multiple declarations#381

Merged
bob-carpenter merged 2 commits into
stan-dev:masterfrom
WardBrian:multiple-decls
Aug 24, 2021
Merged

Document multiple declarations#381
bob-carpenter merged 2 commits into
stan-dev:masterfrom
WardBrian:multiple-decls

Conversation

@WardBrian
Copy link
Copy Markdown
Member

Submission Checklist

  • Builds locally
  • Declare copyright holder and open-source license: see below

Summary

Resolves #379 for the reference manual.

Copyright and Licensing

Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company):
Simons Foundation

By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses:

Copy link
Copy Markdown
Member

@bob-carpenter bob-carpenter left a comment

Choose a reason for hiding this comment

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

The main issue is just not to nest four levels deep. The other comments are either light formatting conventions or suggestions for easier maintainability.

Comment thread src/reference-manual/types.Rmd Outdated
same time defines it to be the value of the expression `5`.

### Assignment typing {-}
#### Assignment typing {-}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think we use four # nesting anywhere. Not sure what the format looks like in HTML or LaTeX.

Rather than using nesting this deep, just pull their super section ("Compound variable declaration and definition") up a level.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

H2s are put on their own pages (unless there is something I can do to disable this), so pulling everything up a level will split this in three -- is that fine? The H4 looks fine in HTML, but in latex it ends up in italics rather than bold


## Compound variable declaration and definition

## Variable declaration
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If this is going to be the first place we talk about this, we want to include some more examples, like

array[N] y;
array[5] matrix[3, 4] A;

There are really three different syntaxes:

  • block variables (sized, constrained)
  • local variables (sized, unconstrained)
  • function argument variables (unsized, unconstrained)

Somehow highlighting this distinction up front would help.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should we consider copying/moving this table from the users guide?
https://mc-stan.org/docs/2_27/stan-users-guide/basic-functions-section.html#type-declarations-for-functions

(though it seems to not include offset/multiplier yet...)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't worry about it for this PR. I opened a new issue: #383

Comment thread src/reference-manual/types.Rmd Outdated
Comment thread src/reference-manual/types.Rmd Outdated
Comment thread src/reference-manual/types.Rmd Outdated
together, so long as the constraint for each variable is the same:

```stan
real<lower=0> x, y;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

spaces around operators, always.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm not sure what this is in reference to. Would you prefer real <lower = 0> x, y;? If so, should also update all of the examples in 5.3 and the rest of the chapter

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, but we can do that later. There is a style guide: https://mc-stan.org/docs/2_27/stan-users-guide/stan-program-style-guide.html

I wouldn't worry about it for this PR---the whole doc needs to be updated. Also, you might want to weigh in on the style guide before we rewrite all the doc examples.

Comment thread src/reference-manual/types.Rmd Outdated
Copy link
Copy Markdown
Member

@bob-carpenter bob-carpenter left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks.

@bob-carpenter bob-carpenter merged commit 4418e07 into stan-dev:master Aug 24, 2021
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.

Reference Manual: Multiple delclarations not documented

2 participants