But what's the issue with dynamic_casts?  My understanding was that they checked the validity of the casts,
adding safety for a very slight performance hit.  Given that these are used once the performance difference
is negligible.

On Nov 6, 2013, at 6:44 PM, Bob Carpenter <notifications@github.com> 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 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
> …
> —
> Reply to this email directly or view it on GitHub.
>