stan-dev / stan

Stan development repository. The master branch contains the current release. The develop branch contains the latest stable development. See the Developer Process Wiki for details.
https://mc-stan.org
BSD 3-Clause "New" or "Revised" License
2.59k stars 370 forks source link

remove std::cout and std::cerr from API #382

Closed bob-carpenter closed 10 years ago

bob-carpenter commented 10 years ago

We can't have std::cout or std::cerr in our API because it doesn't play nicely with uses in clients that control their own streams, like the RStan interface. Interfaces like RStan need to use the R input and output streams instead, or the messages get lost.

The ONLY place we should have the standard I/O streams is in CmdStan.

If we need to pass info about errors or other output, the streams must be plumbed down from the top-level application.

bob-carpenter commented 10 years ago

Suggestion from Ben Goodrich:

bob-carpenter commented 10 years ago

Files to fix:

syclik commented 10 years ago

I'm working on it under Stan's feature/issue-382-remove-std-cout-cerr, in case anyone else wants to help out.

syclik commented 10 years ago

New list:

bob-carpenter commented 10 years ago

The one in generator.hpp (not generators.hpp) is going to be tricky because it's quoted in generated code. We need to have a way to grab an output stream to pass in.

The program_grammar_def.hpp is a stray commented out line that should just be deleted.

On May 19, 2014, at 5:52 PM, Daniel Lee notifications@github.com wrote:

New list:

• src/stan/command/print.cpp • src/stan/command/print.hpp • src/stan/command/stanc.cpp • src/stan/command/stanc_helper.cpp • src/stan/common/command.hpp • src/stan/common/init_adapt.hpp • src/stan/common/init_windowed_adapt.hpp • src/stan/common/write_iteration.hpp • src/stan/gm/grammars/program_grammar_def.hpp • src/stan/gm/generators.hpp • src/stan/io/stan_csv_reader.hpp — Reply to this email directly or view it on GitHub.

syclik commented 10 years ago

Thanks for the heads up.

If the generator.hpp is too complicated, I'll leave it and add another issue for the remaining one.

On Mon, May 19, 2014 at 2:15 PM, Bob Carpenter notifications@github.comwrote:

The one in generator.hpp (not generators.hpp) is going to be tricky because it's quoted in generated code. We need to have a way to grab an output stream to pass in.

The program_grammar_def.hpp is a stray commented out line that should just be deleted.

  • Bob

On May 19, 2014, at 5:52 PM, Daniel Lee notifications@github.com wrote:

New list:

• src/stan/command/print.cpp • src/stan/command/print.hpp • src/stan/command/stanc.cpp • src/stan/command/stanc_helper.cpp • src/stan/common/command.hpp • src/stan/common/init_adapt.hpp • src/stan/common/init_windowed_adapt.hpp • src/stan/common/write_iteration.hpp • src/stan/gm/grammars/program_grammar_def.hpp • src/stan/gm/generators.hpp • src/stan/io/stan_csv_reader.hpp — Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHubhttps://github.com/stan-dev/stan/issues/382#issuecomment-43537859 .

syclik commented 10 years ago

refactoring src/stan/gm/generator.hpp and src/stan/common/command.hpp are beyond the scope of a single pull request, so I'm creating a new issue.

syclik commented 10 years ago

Based on v2.3.0.

source with std::cout
source with std::cerr
test with std::cout
test with std::cerr
syclik commented 10 years ago

I'm working on this again on branch: feature/issue-382-remove-cout-cerr