Re: [Caml-list] Buffer.add_channel hangs

2010-03-17 Thread Stas Miasnikou
On 3/18/10, Martin Jambon wrote: > Stas Miasnikou wrote: >> OCaml 3.11.1, OpenBSD 4.6, i386. >> >> I am trying to read whole file by doing: >> >> let read_file_bin name = >> let ic = open_in_bin name in >> let b = Buffer.create 1024 in >> (try Buffer.add_channel b ic max_int with _ -> ()); (

Re: [Caml-list] Buffer.add_channel hangs

2010-03-17 Thread Goswin von Brederlow
Stas Miasnikou writes: > Hi, > > OCaml 3.11.1, OpenBSD 4.6, i386. > > I am trying to read whole file by doing: > > let read_file_bin name = > let ic = open_in_bin name in > let b = Buffer.create 1024 in > (try Buffer.add_channel b ic max_int with _ -> ()); (* <-- HERE *) > close_in ic; >

Re: [Caml-list] Buffer.add_channel hangs

2010-03-17 Thread Martin Jambon
Stas Miasnikou wrote: > Hi, > > OCaml 3.11.1, OpenBSD 4.6, i386. > > I am trying to read whole file by doing: > > let read_file_bin name = > let ic = open_in_bin name in > let b = Buffer.create 1024 in > (try Buffer.add_channel b ic max_int with _ -> ()); (* <-- HERE *) > close_in ic; >

[Caml-list] Buffer.add_channel hangs

2010-03-17 Thread Stas Miasnikou
Hi, OCaml 3.11.1, OpenBSD 4.6, i386. I am trying to read whole file by doing: let read_file_bin name = let ic = open_in_bin name in let b = Buffer.create 1024 in (try Buffer.add_channel b ic max_int with _ -> ()); (* <-- HERE *) close_in ic; Array.init (Buffer.length b) (fun i -> int_o

RE: [Caml-list] Lazy modules

2010-03-17 Thread Dario Teixeira
Hi, > AFAIK local modules is a syntax extension not a compiler > extension - I expect (not looked at it) that the syntax > extension simply alpha renames all the local module > declarations to make them unique and puts them globally... a > very useful extension but no expressive power added. But

Re: [Caml-list] Lazy modules

2010-03-17 Thread Alain Frisch
On 3/17/2010 6:42 PM, David Allsopp wrote: AFAIK local modules is a syntax extension not a compiler extension - I expect (not looked at it) that the syntax extension simply alpha renames all the local module declarations to make them unique and puts them globally... a very useful extension but no

Re: [Caml-list] Lazy modules

2010-03-17 Thread Dario Teixeira
Hi, > Here is a variant of your version with first-class modules > (which will be available in OCaml 3.12). Compared to your > version, we get the benefit of laziness (the "functor body" > is evaluated only once). I see, thanks. That is actually a very welcome feature; I have in the past attempt

RE: [Caml-list] Lazy modules

2010-03-17 Thread David Allsopp
Dario Teixeira wrote: > I've come across a problem which though novel to me, I presume must be > familiar to those with more ML baggage. Namely, I need a module whose > values are not known at the initialisation stage, since they can only be > determined after reading a configuration file. If thi

Re: [Caml-list] Lazy modules

2010-03-17 Thread Alain Frisch
On 17/03/2010 18:04, Dario Teixeira wrote: In a sense I need a lazy module. Also, note that I find the solution of declaring all values in that module as lazy a bit inelegant. I do have a solution which though hackish and relying on a language extension (local modules) seems to work: I create t

[Caml-list] Lazy modules

2010-03-17 Thread Dario Teixeira
Hi, I've come across a problem which though novel to me, I presume must be familiar to those with more ML baggage. Namely, I need a module whose values are not known at the initialisation stage, since they can only be determined after reading a configuration file. If this were a lone value, I wo

Random segfaults / out of memory [Was: Re: [Caml-list] Rewriting the Digest module causes linking errors]

2010-03-17 Thread Goswin von Brederlow
Goswin von Brederlow writes: >> On Wed, Mar 17, 2010 at 09:27:30AM +0100, Goswin von Brederlow wrote: >>> I want to rewrite the Digest module to expose a more lowlevel interface >>> to the md5 digest and add support to digest Bigarrays. I've patched the >>> respective files involved and it all lo

Re: [Caml-list] Rewriting the Digest module causes linking errors

2010-03-17 Thread Goswin von Brederlow
"Mark Shinwell" writes: > On Wed, Mar 17, 2010 at 09:27:30AM +0100, Goswin von Brederlow wrote: >> I want to rewrite the Digest module to expose a more lowlevel interface >> to the md5 digest and add support to digest Bigarrays. I've patched the >> respective files involved and it all looks alrig

Re: [Caml-list] Rewriting the Digest module causes linking errors

2010-03-17 Thread Mark Shinwell
On Wed, Mar 17, 2010 at 09:27:30AM +0100, Goswin von Brederlow wrote: > I want to rewrite the Digest module to expose a more lowlevel interface > to the md5 digest and add support to digest Bigarrays. I've patched the > respective files involved and it all looks alright but when I try to > build oc

[Caml-list] Rewriting the Digest module causes linking errors

2010-03-17 Thread Goswin von Brederlow
Hi, I want to rewrite the Digest module to expose a more lowlevel interface to the md5 digest and add support to digest Bigarrays. I've patched the respective files involved and it all looks alright but when I try to build ocaml I get the following error: File "_none_", line 1, characters 0-1: Er