<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/07/e098218c5547829c62c6d7fa6ccb376d"
  from="Yaron M. Minsky &lt;yminsky@c...&gt;"
  author="Yaron M. Minsky"
  date="2003-07-17T07:39:29"
  subject="Re: [Caml-list] string buffer as (in|out)_channel"
  prev="2003/07/4212e9f5c49ebf65377b958a70b8c309"
  next="2003/07/fc14ef26b85e295dd4c0b37cdff89fa2"
  prev-in-thread="2003/07/4212e9f5c49ebf65377b958a70b8c309"
  next-in-thread="2003/07/ee704e826e5fbe1ad4b4e1a4e6378562"
  prev-thread="2003/07/997f00f2e1af843a0ab59c0e0a1a80a0"
  next-thread="2003/07/ccd92eb3783074eb7e12bf2b325ce13c"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] string buffer as (in|out)_channel">
<msg 
  url="2003/07/4212e9f5c49ebf65377b958a70b8c309"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2003-07-17T07:06:04"
  subject="[Caml-list] string buffer as (in|out)_channel">
<msg 
  url="2003/07/e098218c5547829c62c6d7fa6ccb376d"
  from="Yaron M. Minsky &lt;yminsky@c...&gt;"
  author="Yaron M. Minsky"
  date="2003-07-17T07:39:29"
  subject="Re: [Caml-list] string buffer as (in|out)_channel">
</msg>
<msg 
  url="2003/07/ee704e826e5fbe1ad4b4e1a4e6378562"
  from="Issac Trotts &lt;ijtrotts@u...&gt;"
  author="Issac Trotts"
  date="2003-07-18T09:13:30"
  subject="Re: [Caml-list] string buffer as (in|out)_channel">
</msg>
<msg 
  url="2003/07/9cc4ec136348d1af781de9f8f7ad3a6d"
  from="Issac Trotts &lt;ijtrotts@u...&gt;"
  author="Issac Trotts"
  date="2003-07-18T09:40:34"
  subject="Re: [Caml-list] string buffer as (in|out)_channel">
</msg>
</msg>
</thread>

<contents>
I think this is the kind of place where it would make sense to use the
object system.  That is, in addition to the low-level in_channel and
out_channel, which essentially serve as proxies for unix file-descriptor
based channels, there should be I/O objects with a standard signature
for files, strings, buffers, etc.  I actually have done a simple version
of this for myself as part of the SKS project, but I think something
along these lines would be useful as a standard part of ocaml, including
integration with printf and other places in the standard library that
use I/O.  

As for your precise question, I don't myself know of any way to convert
a Buffer.t to an i/o channel.

y

On Thu, 2003-07-17 at 03:05, Chris Hecker wrote:
&gt; Is there any way to do something similar to the C++ string stream stuff, 
&gt; where you treat strings (or Buffer.t's) as in_ or out_channels?  The Format 
&gt; module has a formatter for strings, but there doesn't seem to be a way to 
&gt; do it with Pervasives.  Something like:
&gt; 
&gt; val out_channel_of_buffer : Buffer.t -&gt; out_channel
&gt; val in_channel_of_buffer : Buffer.t -&gt; in_channel
&gt; 
&gt; and maybe _of_string versions too (probably necessary because you can't 
&gt; convert a string to a buffer for the in_channel), which fill up and don't 
&gt; expand.
&gt; 
&gt; It'd be very useful to be able to do this.
&gt; 
&gt; Thanks,
&gt; Chris
&gt; 
&gt; PS.  Please cc me on replies, I temporarily unsubscribed from the list, thanks!
&gt; 
&gt; -------------------
&gt; To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
&gt; Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
&gt; Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
-- 
|--------/            Yaron M. Minsky              \--------|
|--------\ http://www.cs.cornell.edu/home/yminsky/ /--------|

Open PGP --- KeyID B1FFD916 (new key as of Dec 4th)
Fingerprint: 5BF6 83E1 0CE3 1043 95D8 F8D5 9F12 B3A9 B1FF D916



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

</contents>

</message>

