It's the implication that we're going to do run-time type
checking, which I'd prefer to avoid.  I'm just a static
type-checking nut, hence all the type declarations in Stan.

Let me get some time to look at the code when we get the
Novartis models under control (we just fit some fake data
in pretty much the full model and it seems to be working).
Maybe I can figure out how to get rid of the casts.

- Bob

On 11/6/13, 3:24 PM, 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();
>
> 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.
>
> —
> Reply to this email directly or view it on GitHub <https://github.com/stan-dev/stan/pull/356/files#r7476972>.
>