gadget-framework / gadget3

TMB-based gadget implemtation
GNU General Public License v2.0
8 stars 6 forks source link

Replace g3_with -> local() #90

Open lentinj opened 1 year ago

lentinj commented 1 year ago

To be able to split of formula_utils, we need to have something that's actual R in place of g3_with.

local() is the obvious candidate, replacing g3_with(var1 := val1, var2 := val2, { stock__num <- var1 * var2 }) with local({var1 <- val1 ; var2 <- val2 ; stock__num <<- var1 * var2}).

However, this isn't brilliant since assignments to stock__num outside of local() will still have to use <-. Remembering which to use sounds painful.

There's also a performance concern about all the extra environments, but this could be rewritten out if required.