Stanc3 as submodule of cmdstan

Yes, that is the plan I think. Though I would personally wait at least until we have stanc3 in rstan for a release cycle before removing the stanc2 sources from the repo. Because that is when stanc3 will hit the majority of the users and we want to have a simple way of debugging issues.

The binary is downloaded only on the develop (clone) versions. In release tarballs the binaries are already present, so there is no need for additional downloading.

The makefiles for cmdstan work like this for stanc (as of 2.22):

  • if STANC3 is set, build stanc3 from source using dune build
  • if no STANC3 and if there is a OS-specific binary present (bin/windows-stanc, bin/linux-stanc, bin/mac-stanc) then rename the applicable to bin/stanc
  • if none of the above applies, download the appropriate binary from stan-dev/stanc3

A huge downside of not downloading binaries is that requires building Ocaml code which means installing all the tools. I dont think we want to go that way.