Skip to content

Remove deferred compilation and $compile(); add standalone file operations #1256

Description

@jgabry

Remove deferred compilation and $compile(); add standalone file operations

Design note: #1254.

cmdstan_model(compile = FALSE) and the $compile() method both go. Options are one-shot: a build is configured on the call that performs it (#1254 §2). The replacement API (compile_stan_file(), format_stan_file(), check_syntax_stan_file(), stan_variables(), stan_build_info() and the shared compile_impl()) is #1254 §8 ("Contract: the API that replaces deferred compilation"), including the names, the argument lists and why $compile() is removed rather than narrowed.

Stage 4 (#1258), shipping together with #1255: if $compile() goes before configuration mismatches trigger rebuilds, an existing unthreaded executable is still reused under today's logic while the only escape route is gone.

Current usage to migrate: 96 compile = FALSE in tests, 10 in R/, 9 in man/, 5 in vignettes.

Checklist

  • compile_impl() lifted from today's $compile(), returning path, record, src_info and hpp_code; compile_stan_file() and cmdstan_model() are its only callers (Design note: v1.0 compilation state and C++ options #1254 §8, "compile_stan_file() is exported, and shares one implementation")
  • The standalone family exported, every one that hands a source file to stanc taking include_paths; _pkgdown.yml entries added and $compile()'s removed
  • compile_model_methods and compile_standalone removed (Design note: v1.0 compilation state and C++ options #1254 §8, "compile_model_methods and compile_standalone are removed")
  • dry_run internal only; its 22 test uses are what make migrating the compile = FALSE sites affordable
  • Remove precompile_stanc_options_, precompile_include_paths_, precompile_cpp_options_, the %||% include-path baseline and include_paths_dirty_ (R/model.R:642-656)
  • $format() stops refreshing stan_code_ and variables_ (R/model.R:1309-1311); reformatting in place now costs a recompile, with a NEWS entry (Design note: v1.0 compilation state and C++ options #1254 §5, "Introspection is a construction-time snapshot")
  • Closes $check_syntax() and $format() inherit stanc options meant for compilation #1252: its premise, compile-time stanc options leaking into $check_syntax() and $format(), disappears with the precompile store
  • stan_variables() is the one name to revisit before it ships: metadata()$stan_variables on fit objects (R/csv.R:362) means the output variables, not the program's declarations

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions