nimble-dev / nimble

The base NIMBLE package for R
http://R-nimble.org
BSD 3-Clause "New" or "Revised" License
160 stars 24 forks source link

Use safeDeparse instead of as.character in macro parameter processing #1464

Closed kenkellner closed 5 months ago

perrydv commented 5 months ago

Thanks @kenkellner . This makes sense. Is a similar change needed in getParametersFromCode, or are those as.character calls safe?

kenkellner commented 5 months ago

@perrydv The output of getParametersFromCodeInternal should already be character (ultimately from all.vars()) or NULL. So all those as.character calls should be doing is converting instances of NULL to character(0). safeDeparse would actually give the wrong result ("NULL"). Probably this should be more clear/explicit - I can look into it tomorrow if needed.