Closed VMatthijs closed 4 years ago
@bob-carpenter , thoughts on this? Is the manual wrong or the implementation?
I would think they should have the same precedence and make both and . left associative. That way, the example
[3, 4] 2 . [5, 6]
will be parsed as
([3, 4] 2) . [5, 6]
On Dec 14, 2018, at 10:27 AM, Matthijs Vákár notifications@github.com wrote:
@bob-carpenter , thoughts on this? Is the manual wrong or the implementation?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Thanks! So the docs should be changed as well then? What about ./? Should that also have the same precedence?
Yes, ./ and / should have same precedence (and presumably the same precedence as . and ).
On Dec 14, 2018, at 12:16 PM, Matthijs Vákár notifications@github.com wrote:
Thanks! So the docs should be changed as well then? What about ./? Should that also have the same precedence?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Fixed in stanc3 and in docs (https://github.com/stan-dev/docs/pull/65).
Summary:
There is an inconsistency between the operator precedence as implemented in stanc2 and as described in the manual.
Description:
The manual describes that
.*
binds more tightly than*
. stanc2 seems to bind*
more tightly.Reproducible Steps:
Try to compile
Get error
So clearly, the signatures for . are vector . vector row_vector . row_vector matrix . matrix .
Now, if we try to compile
we would expect that to fail. Indeed, it should be parsed as
according to the manual. However, it parses just fine and prints [3, 8] when it runs. This suggests strongly to me that it has parsed the model as
instead.
Additional Information:
Rstanarm is currently exploiting this bug.
This also makes me worried about the other stated operator precedences. Has this been resulting in incorrect generated code?
Current Version:
v2.18.0