[mercury-users] Extending library modules, such as io.m (was: Re: zlib binding)

Ondrej Bojar obo at cuni.cz
Fri Dec 1 15:50:05 AEDT 2006


Hi,

Peter, thanks for the sample.

I'm now trying to copy-paste some io.m routines to a new module and 
replace the very 'fopen' with gzopen (keeping all intermediate helper 
functions like in io.m). However, I would but produce 'genuine' 
io.input_stream.

This is something that goes very much against the spirit of module 
encapsulation, because my module would need to have access to io.m's 
internal data constructors.

I wish to create a genuine io.input_stream, because then I can use the 
normal io predicates and functions. If all the useful library functions 
relied on type classes, there would be no need to fake io.input_stream, 
I would just instantiate core reader functions for a new gzinput_stream 
type.

Is there a way to hack it around now, or should I wait (indefinitely) 
for the library to switch to type classes?

(I'm not in a hurry, I might as well use a completely different approach 
with gdbm.)

Thanks, Ondrej.

P.S.: Making a copy of io.m, adding the modified open there and 
compiling this would undoubtedly lead to linking problems. Or worse, 
random choice of old io routines and my io routines (?).

Peter Hawkins wrote:
> Hi...
> 
> I started an interface to the in-memory parts of zlib, but didn't
> finish it since the project that needed it turned out to be a bad idea
> (tabling, blech :-) )
> 
> I've attached what I have. It doesn't really fit your description but
> it might be a start. It depends on a hacked up binary string module I
> wrote.
> 
> Cheers,
> Peter
> 
> On 11/30/06, Ondrej Bojar <obo at cuni.cz> wrote:
> 
>> Hi, everyone.
>>
>> I wonder if anybody has a zlib binding for Mercury ready, a replacement
>> for io__open_input that would read gzipped files?
>>
>> Thanks, Ondrej.
>>

-- 
Ondrej Bojar (mailto:obo at cuni.cz)
http://www.cuni.cz/~obo
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list