-
-
Notifications
You must be signed in to change notification settings - Fork 378
Stan reference: local variables #1431
Description
The term local variable is used a lot in the manual but it is difficult to extract a complete definition. For example, section 25.7 says:
At the beginning of each block, local variables may be declared that are scoped over the rest of the
statements in the block.
However, since all variables are defined at the beginning of a block, that would mean that all variables are local, which is clearly not the case. On the other hand, the section variable scope explains that variables declared in one program block are visible in subsequent blocks except for variables declared in the model block. This section, however, fails to mention that this is not the case for variables declared in nested blocks.
I think it would help if there was one place in the manual that gives the whole story. It may also make sense to use this opportunity to clarify why the term global variable isn't used (only variables in the data block are global).