nimble icon indicating copy to clipboard operation
nimble copied to clipboard

constant 'pi' in model code doesn't work

Open perrydv opened this issue 1 year ago • 6 comments

This must have once worked?

m <- nimbleModel(
  nimbleCode({my_pi <- pi})
)
m$my_pi #NA

perrydv avatar Mar 08 '23 17:03 perrydv

Please see issue #92 - we had a lengthy discussion of this and decided not to handle it natively.

paciorek avatar Mar 08 '23 17:03 paciorek

Oh yeah, thanks. I guess we could error-trap it?

perrydv avatar Mar 08 '23 22:03 perrydv

Error trap in what manner?

One logical perspective is that pi should be a valid variable name in models (for stochastic, or RHS nodes) as in this example, without throwing in error.

danielturek avatar Mar 10 '23 14:03 danielturek

Maybe, perhaps, issuing a Note, at the time of model building:

[Note]: The use of "pi" as a variable name is detected in model.
This will represent a model variable the same as any other name,
and will not have any implied connection with the numerical value 3.14159....

danielturek avatar Mar 10 '23 14:03 danielturek

Yes, I was imagining a short note if we detect pi in a model and it was not set as part of data, constants, or inits.

paciorek avatar Mar 10 '23 15:03 paciorek

Should make sure it's only RHS.

paciorek avatar Mar 10 '23 22:03 paciorek