Default arguments/Parameter packs

Alright yeah this is a problem and this’ll need to be something figured out at the Stan language level.

If we just extend the current ODE signatures and try to make the arguments variable length we’d get:

integrator(function ode, real[] initial_state, real initial_time, real[] times,
          T1 arg1, T2 arg2, ...)
integrator(function ode, real[] initial_state, real initial_time, real[] times,
           T1 arg1, T2 arg2, ...,
           double reltol, double abstol, int maxsteps)

And ode would need the signature:

real[] ode(real time, real[] state, T1 arg1, T2 arg2, ...)

The problem is if I made the call:

integrator(my_func, y0, t0, ts, 1e-6, 1e-6, 1e6)

Are those last three arguments meant to be passed through to the ODE function as arg1, arg2, …, or do they specify the tolerances + maxsteps?

We can solve this problem in C++ by passing template arguments for what T1, T2, etc. are specifically (which is the earlier part of this thread).

(edit: the same ambiguity exists if we try to put the optional parameters before the variadic parameters)