print statement stream passing

4 views
Skip to first unread message

Bob Carpenter

unread,
Sep 17, 2012, 12:18:43 PM9/17/12
to stan...@googlegroups.com
I'm almost done with passing the print streams
through to the model. There's an issue of whether
to

1. use ostream* and let the pointer be 0 to turn
off printing,

2. use ostream* and use STAN_NO_DEBUG or 0 value to
turn off printing,

3. use ostream& and use STAN_NO_DEBUG to turn off printing,

4. use ostream& with no shut off valve.

We used option (1) for error messages (like domain errors
that crop up in the model), and I think
they should match whatever we do for model prints, but
it's all easy to change. That does bring up an independent
question:

A. Should I share the ostream* between error messages?

Now that I think of it, I like A! I don't see when
a user would set them to different streams.

- Bob

Marcus Brubaker

unread,
Sep 17, 2012, 1:03:20 PM9/17/12
to stan...@googlegroups.com
I'm not sure conditioning on STAN_NO_DEBUG is appropriate here. If I
put a print statement in a model, regardless of how I compile it, I
would expect it to function as such.

Also, is the use of ostream compatible with the R printing interface?

Cheers,
Marcus
> --
>
>

Bob Carpenter

unread,
Sep 17, 2012, 1:37:59 PM9/17/12
to stan...@googlegroups.com


On 9/17/12 1:03 PM, Marcus Brubaker wrote:
> I'm not sure conditioning on STAN_NO_DEBUG is appropriate here. If I
> put a print statement in a model, regardless of how I compile it, I
> would expect it to function as such.

That makes sense. That's how I first set it up.

The only reason I can imagine for printing is to
do debugging. So I imagine adding prints if things
go wrong and then taking them out when everything's
working. That should also keep the models cleaner.

> Also, is the use of ostream compatible with the R printing interface?

Yes, we'll just pass in a stream from R as Jiqiang
pointed out we're already doing for error messages from
domain errors in distributions.

I was going to set things up to use the same stream,
but I might as well follow the standard convention
of having separate print and error streams.

I should have this done soon and will check it in.

- Bob

Reply all
Reply to author
Forward
0 new messages