[m-dev.] streams in Mercury

Julien Fischer juliensf at cs.mu.OZ.AU
Wed Dec 14 04:54:01 AEDT 2005


On Wed, 14 Dec 2005, Ian MacLarty wrote:

> On Wed, Dec 14, 2005 at 02:58:26AM +1100, Julien Fischer wrote:
> >
> >
> > Some initial comments/questions:
> >
> > On Wed, 14 Dec 2005, Ian MacLarty wrote:
> >
> > > Hello,
> > >
> > > At MC we're using many different streams besides normal file streams
> > > (such as sockets, ssl and logging streams).  Peter has therefore defined
> > > some stream typeclasses and rewritten some parts of io.m for reading and
> > > writing to general streams.
> > >
> >
> > How similar are the stream typeclasses to the stuff in extras/stream?
> >
>
> Very similar.
>
> > ...
> >
> > > Are there any thoughts on this idea?
> >
> > Search for streams on the mailing list archive.
>
> There were a lot of results.  I didn't see anything to suggest my
> proposal is a bad idea.
>

My point was that there has already been a good deal of discussion
about streams and associated issues.

> >
> > ...
> >
> > > I thought of using the new MercuryFile C type, but that approach has two
> > > problems:
> > >    1.  It requires writing C code to implement a new type of stream.
> > >    2.  It requires the compiler to be built with a special flag to turn
> > >        on the use of this structure.
> > >
> >
> > We could use the MercuryFile structure by default, although the question
> > then becomes what sort of overhead is that going to entail?  Do MC have
> > any figures on how the MercuryFile struct compares to normal files?
> > (If not then that can be another job for Samrith ;-))
> >
>
> The overhead ratio will depend on what kind of stream you're writing to.
>

I was referring to stdin and stdout.

> Using MercuryFile you will always have to do a pointer lookup, but using
> typeclasses presumably you could specialise the dereference away for
> common instances.
>

You may be overestimating how well we optimize code involving
typeclasses.

Cheers,
Julien.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list