We use polymorphism all over the place!  That's what
a template parameter gives you.

We've tried very hard to avoid any run-time polymorphism
that can fail.  So we have some OO polymorphism (for instance
in reverse-mode auto-diff), but there's no casting required
at run time.

I'd say go with static casts if you can.  You want to catch
programming errors during programming time and fix later errors
you found, but you don't want to write the code to catch
or check programming errors.  For example, only check inputs to
external functions, not internal ones, which can be controlled
by the programmer.

- Bob

On 11/6/13, 6:37 AM, Michael Betancourt wrote:
> In src/stan/gm/command.hpp:
>
>>      template<class Sampler>
>>      bool init_adapt(stan::mcmc::base_mcmc* sampler, categorical_argument* adapt) {
>> -
>> +
>>        double delta = dynamic_cast<real_argument*>(adapt->arg("delta"))->value();
>
> We also don't use polymorphism anywhere. I just stuck with safer casting by habit, but it also helps in debugging when
> poor casts are used.
>
> —
> Reply to this email directly or view it on GitHub <https://github.com/stan-dev/stan/pull/356/files#r7461074>.
>