[m-dev.] for review: bug fix for browser output streams.
fjh at cs.mu.OZ.AU
Fri Dec 18 00:12:21 AEDT 1998
On 17-Dec-1998, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> On 17-Dec-1998, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > This change (using stderr instead of stdout) broke all the
> > debugger test cases.
> I've been meaning to fix this, but have been working on other things.
I fixed it last night, so don't worry about that now.
> > > I agree. That's why I went to all the trouble of putting the input
> > > and output streams into the browser state instead of just hardcoding
> > > them when required.
> > I'm not sure that was a good idea. After all, with your change,
> > the top-level routines extract the streams from the browser
> > state and put them into the io__state (using io__set_current_input
> > and io__set_current_output). The intermediate and bottom-level
> > routines don't access the stream fields of the browser state
> > at all. So it may be easier to just pass the streams as arguments,
> > rather than storing them in the browser_state.
> I don't see why this is a problem. The top-level routines set
> the stream that the lowel level routines will use. You could
> thread it all the way through to the low level, but eventually the
> low level code just does a "io__set_current_input" anyway.
I meant passing the stream as arguments in the top-level routines
> The intention is that you can add a single new predicate to set the
> stream in the browser state and so change what stream everything
> uses. No other code needs to be changed.
Well, instead of adding a new predicate, I was just going to add
new arguments to the existing browse__init_state predicate.
That seems equally simple, right?
But then, I thought, why not add the new arguments to browse__browse
and browse__print rather than to browse__init_state?
After all, those are the only procedures which use the streams.
They call io__set_current_input/output, and all other procedures
just use the current streams set in the io__state.
Passing the stream arguments to two procedures rather than one
is not much more difficult, and it avoids the need to store
the streams in the browser state and extract them again,
so overall I think this approach is simpler.
Fergus Henderson <fjh at cs.mu.oz.au> | "Binaries may die
WWW: <http://www.cs.mu.oz.au/~fjh> | but source code lives forever"
PGP: finger fjh at 184.108.40.206 | -- leaked Microsoft memo.
More information about the developers