What we have now is fine for CmdStan, but I can't speak for
the other interfaces. I'm sure CmdStan would be easy to
modify for whatever we decide.
The Stan 3 command refactor has the interfaces pass in
callbacks for I/O. This allows consistent behavior
across interfaces, which is my main goal along with removing
code duplication.
I don't like the idea of having the interfaces catch the
exceptions and deal with them as it will neither reduce
code duplication nor encourage consistent behavior across interfaces.
Right now, we have a callback structure for the interfaces,
but the callback is a simple output stream. It would be a
lot of work, but straightforward to change the parser API to pass
in a structured callback handler for warnings, errors, etc.
So the question is what should it do?
For example, how much logger-like behavior do you want?
Loggers often configure messages to have log levels, like
fatal error, recoverable error, warning, debug (very verbose mode), etc.
Here's the spec for log4j:
https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html
Then there's the issue of formatting the output --- do you include
thread IDs, time stamps, etc. And then there's the issue of how a user
or programmatic client configures the logger and where it pipes output.
- Bob
P.S. I don't like big heterogeneous data structures for returns.
For example, I don't like the return for R's built-in lm() function,
because it's mutable in such a way that allows it to get into
inconsistent states (models mismatching data mismatching estimates).
There are ways to mitigate these problems, but I think the callback
route is much cleaner. And it allows streaming.