Nicolas Cannasse wrote:
>> A recent project required me to parse gzipped XML files using Xml-Light.
>> The most convenient way to access the gzipped files was using Extlib's
>> Unzip.inflate on an IO.input stream. However, since Xml-Light does not
>> support IO or the standard OO file interface (it only supports input
>> from files, Pervasives streams, strings, and lexbufs), it was necessary
>> to define a wrapper function:
>>
>> let lexbuf_of_input i =
>> Lexing.from_function
>> (fun s n ->
>> try
>> IO.input i s 0 n
>> with IO.No_more_input ->
>> 0);;
>>
>> I just wonder whether it might be worth adding a couple of conversion
>> functions along these lines to the IO module, since I can imagine them
>> being generally useful? The code is trivial, but one of the things I
>> value Extlib for is that it reduces the need for boilerplate like this.
>
> Hi Peter,
>
> The only problem is that this would create an IO -> Lexing dependency.
> OCaml performs linkage on a per-module basis so not sure it's nice to
> add such an overweight for a single simple function.
>
That reminds me... At one point I also wanted to add
"input_of_file_descr" and "output_of_file_descr" to the IO module. In
fact, I'd still be interested in adding these.
Could we maybe add a new "IO_extras" module for such
not-strictly-needed-but-nice-to-have functionality?
--
Bardur Arantsson
<bardurREMOVE@xxxxxxxxxxxxxxxxxxx>
- Ouch! That's going to bleed when my heart beats.
Professor Farnsworth, 'Futurama'
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|