Closed WardBrian closed 1 year ago
During today's language meeting @bob-carpenter suggested we may just be able to deprecate and remove this function. The CmdStan source only uses it twice, and it's largely redundant with get_param_names
(especially if we go with #1245)
Another possibility besides deleting it is doing the same thing var_context
has to do and building it up such that each tuple sub-part has a dimension, e.g. array[2] tuple(real, array[3] int) x
would result in a length-2 get_dims
, { { 2 }, { 2, 3 } }
.
This would probably only make sense if we changed get_param_names
to have the same behavior and return { "x.1", "x.2" }
for the above (currently it would return just { "x" }
)
Looking at where get_param_names
and get_dims
are typically used, it seems like they are almost always used in conjunction with a var_context
, so doing what they do (described in the previous comment) seems correct.
With the addition of unconstrain_array
in #1305, we should probably deprecate the get_dims
function, especially since ragged arrays etc don't even have the hacky workaround from above.
In the spirit of https://github.com/stan-dev/stanc3/issues/820, we need to decide how tuples should be represented by get_dims. The return value being type
vector<vector<size_t>
strongly implies rectangular objects, which tuples are not.