Document multiple declarations#381
Conversation
bob-carpenter
left a comment
There was a problem hiding this comment.
The main issue is just not to nest four levels deep. The other comments are either light formatting conventions or suggestions for easier maintainability.
| same time defines it to be the value of the expression `5`. | ||
|
|
||
| ### Assignment typing {-} | ||
| #### Assignment typing {-} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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...)
There was a problem hiding this comment.
Don't worry about it for this PR. I opened a new issue: #383
| together, so long as the constraint for each variable is the same: | ||
|
|
||
| ```stan | ||
| real<lower=0> x, y; |
There was a problem hiding this comment.
spaces around operators, always.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
Submission Checklist
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: