RE: [Caml-list] help with regular expression

2010-12-06 Thread David Allsopp
zaid Khalid wrote: Hi Folks I want some help in writing regular expressions in Ocaml, as I know how to write it in informal way but in Ocaml syntax I can not. For example I want to write a* | (aba)* . This question would better be posted on the beginners' list -

RE: [Caml-list] Is OCaml fast?

2010-11-24 Thread David Allsopp
Thanassis Tsiodras wrote: I apologize beforehand if this is not the forum to ask. I am on the fence about whether to learn OCaml or not, and while reading an article called Why OCaml (http://www.cs.ubc.ca/~murphyk/Software/Ocaml/why_ocaml.html), I saw that OCaml was praised for the speed of

RE: [Caml-list] Re: Is OCaml fast?

2010-11-24 Thread David Allsopp
Isaac Gouy wrote: David Allsopp dra-news at metastack.com writes: -snip- Reducing an entire programming language's strengths (or weaknesses!) to a single number is just not really realistic - the truth is more complex than one single-precision floating point number (or even an array

RE: [Caml-list] [Was: Is OCaml fast?] Not really sure...

2010-11-24 Thread David Allsopp
Isaac Gouy wrote: Ed Keith e_d_k at yahoo.com writes: I am not asking WHAT the rules are but a JUSTIFICATION for them (which you have been incapable of providing so far). I feel no need to provide a JUSTIFICATION to you for anything. Am I to interpret this to mean that

RE: [Caml-list] SMP multithreading

2010-11-18 Thread David Allsopp
Edgar Friendly wrote: It looks like high-performance computing of the near future will be built out of many machines (message passing), each with many cores (SMP). One could use message passing for all communication in such a system, but a hybrid approach might be best for this architecture,

RE: [Caml-list] type inference problem with Printf.sprintf ?

2010-10-26 Thread David Allsopp
Emmanuel Dieul wrote: Hi everyone. I've just noticed a type inference problem (or am I wrong ?). Here's my example : let format_date = let format_valeur = function valeur - (if valeur 10 then 0 else ) ^ (string_of_int valeur) Your main problem has already been answered but it's

RE: [Caml-list] Code-execution (evaluation) time

2010-10-19 Thread David Allsopp
Oliver Bandel wrote: Hello, I want to refresh my OCaml knowledge after I (again) paused for a while. I want to know, when certain parts of the code are executed, for example if I have more than one let _ = ... statement in my code (for example in different comp0ilaion units each one of

RE: [Caml-list] Marshalling question

2010-10-08 Thread David Allsopp
Jean Krivine wrote: Dear ocaml users, A simple question: is it safe to marshalize a data structure that contains imperative elements (like arrays or hashtbl) ? Simple answer: yes. Marshal works on the runtime representation of data which is imperative (immutability is enforced by the type

RE: [Caml-list] Windows filenames and Unicode

2010-09-29 Thread David Allsopp
Paul Steckler wrote: In Windows, NTFS filenames are specified in Unicode (UTF-16). Am I right in thinking that OCaml file primitives, like open_in, readdir, etc. cannot handle NTFS filenames containing characters with codepoints greater than 255? Given that the WinAPI wide functions use

RE: [Caml-list] Windows filenames and Unicode

2010-09-29 Thread David Allsopp
Paul Steckler wrote: On Wed, Sep 29, 2010 at 4:23 PM, David Allsopp dra-n...@metastack.com wrote: A way (but not foolproof on Windows 7 and Windows 2008 R2 because you can disable it) would be to wrap the GetShortPathName Windows API function[1] which will convert the pathname to its DOS

RE: [Caml-list] quotations inside comments?

2010-08-31 Thread David Allsopp
Hi, why does camlp4 parse quotations inside comments? Eg I don't know for certain, but I guess it might be for the same reason as the compiler which checks string literals (amongst other things) inside comments e.g. (* This will not compile *) File foo.ml, line 1, characters 0-2: Error:

RE: [Caml-list] More re GC hanging

2010-08-15 Thread David Allsopp
Adrien wrote: Hi, snip Also, on my computer, I have the following behaviour: 11:44 ~ % sudo echo 0 /proc/sys/kernel/randomize_va_space zsh: permission denied: /proc/sys/kernel/randomize_va_space r...@jarjar:~# echo 0 /proc/sys/kernel/randomize_va_space r...@jarjar:~# I

RE: [Caml-list] Distinguish between osx and linux programmatically

2010-07-08 Thread David Allsopp
Oliver Bandel wrote: On Thu, Jul 08, 2010 at 06:01:24PM +0100, Richard Jones wrote: On Thu, Jul 08, 2010 at 10:42:40AM -0500, Romain Beauxis wrote: Le jeudi 8 juillet 2010 06:44:34, Richard Jones a écrit : Stdlib could bind the uname(2) syscall, but it's legendary in its complexity.

RE: [Caml-list] Re: adding a scripting language to an ocaml program

2010-07-03 Thread David Allsopp
Martin DeMello wrote: On Sun, Jul 4, 2010 at 12:13 AM, Michael Ekstrand mich...@elehack.net wrote: The authors of C-- have implemented a Lua engine in OCaml, with a good, high-level, type-safe interface for embedding it.  Look for 'lua- ml'. There is also an OCaml implementation of Scheme

RE: [Caml-list] OCaml 3.12.0+beta1

2010-06-25 Thread David Allsopp
bluestorm wrote: Here is a small Camlp4 filter removing exhaustive patterns. It obviously depends on 3.12. snip Notes : - that the OCaml printer expand sugared { a; b } patters into { a = a; b = b } is necessary for printing backward-compatible code; I'm not sure it's a good idea to

RE: [Caml-list] Unix.send blocks

2010-06-16 Thread David Allsopp
k/Paul Steckler wrote: I've written a wee Web server in OCaml that's compiled using the ocamlopt from the Fedora MinGW distribution of ocaml. I'm running the server in Windows 7. Sometimes after receiving several requests, the Unix.send call that sends a response back to a Web client just

RE: [Caml-list] Converting variants with only constant constructors to integers

2010-06-08 Thread David Allsopp
W Dan Meyer wrote: bluestorm bluestorm.d...@gmail.com writes: Beware that %identity is an unsafe feature that breaks all safety guarantees if used badly. Yes %identity is another solution. Although as safe as Obj.magic. It's a bit pedantic but the %identity *primitive* is not the evil

RE: [Caml-list] Converting variants with only constant constructors to integers

2010-06-08 Thread David Allsopp
Gabriel Scherer wrote: Incidentally, the general function for getting a unique integer for a variant type with non-constant constructors isn't that bad either: let int_of_gen x =  let x = Obj.repr x  in    if Obj.is_block x    then -1 * Obj.tag x - 1    else (Obj.magic x : int) I consider

RE: [Caml-list] Converting variants with only constant constructors to integers

2010-06-08 Thread David Allsopp
Luc Maranget wrote: Of course, if you have the following: type t = A | B | C let int_of_t = function A - 0 | B - 1 | C - 2 Then in fact I believe that the compiler already converts that to a hashtable lookup instead of a sequence of jumps.. The compiler does not convert the

RE: [Caml-list] Converting variants with only constant constructors to integers

2010-06-08 Thread David Allsopp
Luc Maranget wrote: Luc Maranget wrote: Of course, if you have the following: type t = A | B | C let int_of_t = function A - 0 | B - 1 | C - 2 Then in fact I believe that the compiler already converts that to a hashtable lookup instead of a sequence of

RE: [Caml-list] Static exception analysis or alternative to using exceptions

2010-05-31 Thread David Allsopp
Goswin von Brederlow wrote: snip However if the exception is, say, an I/O error reading a disk file, these should be thrown, and caught somewhere central where you can display an error message to the user (for GUI programs) or abort the current transaction (for server programs).

RE: [Caml-list] OCaml compilation

2010-05-28 Thread David Allsopp
Matthieu Dubuget wrote: Hello, I'm trying to compile ocaml (mingw) on XP. I did not succeed, and could reproduce the very same behaviour on two computers (a real one, and in a virtual machine). On my main development system, the compilation does not fail. The difference may be that I

RE: [Caml-list] Static exception analysis or alternative to using exceptions

2010-05-27 Thread David Allsopp
Florent Ouchet wrote: Same here, specially to avoid the Not_found exception. The optional return values gives the oportunity to have a clear view of what is being done if the result is not available. Agreed - though [find] is one of the examples where you do need find and find_exc - because

RE: [Caml-list] Static exception analysis or alternative to using exceptions

2010-05-27 Thread David Allsopp
Daniel Bünzli wrote: Agreed - though [find] is one of the examples where you do need find and find_exc - because often there are occasions where before calling {Map,Set,Hashtbl}.find you already know that the key exists and so won't fail at which point the 'a option boxing is a waste of

RE: [Caml-list] Static exception analysis or alternative to using exceptions

2010-05-27 Thread David Allsopp
Mark Shinwell wrote: On Thu, May 27, 2010 at 09:54:29AM +0100, David Allsopp wrote: Florent Ouchet wrote: Same here, specially to avoid the Not_found exception. The optional return values gives the oportunity to have a clear view of what is being done if the result is not available

RE: [Caml-list] A Tutorial on GNU Make with OCaml

2010-05-21 Thread David Allsopp
Michael Grünewald wrote: Dear Jeff, Jeff Shaw wrote: Dear OCamlers, I spent quite a lot of time today getting better acquainted with GNU make and decided I to share my experience and results. It's a bit on the newbie friendly side of instruction.

RE: [Caml-list] Re: about OcamIL

2010-05-19 Thread David Allsopp
Eray Ozkural wrote: On Wed, May 19, 2010 at 2:29 PM, Michael Ekstrand mich...@elehack.net wrote: Yes, Python's hash tables are particularly optimized due to their wide pervasive usage.  When you're testing Python hash tables, you're really testing a carefully-written, thoroughly-tuned C

RE: [Caml-list] SHA1 = stdlib ?!

2010-04-25 Thread David Allsopp
Oliver Bandel wrote: Zitat von Eric Cooper e...@cmu.edu: On Sat, Apr 24, 2010 at 02:27:47PM +0200, Oliver Bandel wrote: is it planned, to also include SHA1-Hash into stdlib? I don't know about stdlib, but the ocaml-sha library (http://tab.snarc.org/projects/ocaml_sha/) provides Sha1

RE: [Caml-list] Lazy modules

2010-03-18 Thread David Allsopp
Alain Frisch wrote: 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

RE: [Caml-list] Lazy modules

2010-03-18 Thread David Allsopp
Dario Teixeira wrote: 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

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 this

RE: [Caml-list] camelia on windows config problem

2010-03-15 Thread David Allsopp
Michael Hicks wrote: I've just been playing with using camelia on Windows, since some students in my class are using it. My problem is that I can't figure out how to configure Camelia to run a non-Cygwin Ocaml. My installation puts the executables in C:\Program Files\Objective Caml\bin,

RE: [Caml-list] Recursive subtyping issue

2010-03-01 Thread David Allsopp
Guillaume Yziquel wrote: Stéphane Glondu a écrit : Guillaume Yziquel a écrit : # type untyped;; type untyped # type 'a typed = private untyped;; type 'a typed = private untyped # type -'typing tau = private obj and 'a t = 'a typed tau and obj = private untyped tau;; type 'a

RE: [Caml-list] [newbie] miscellaneous on installation and web site

2010-03-01 Thread David Allsopp
Marco Maggi wrote: Ciao, I am a True Beginner taking a look at O'Caml; I hope not to be abusing by posting here rather than the beginners list. Building OCaml from source is definitely not a beginners' question! :o) I think I successfully compiled ocaml-3.11.2 on my

RE: [Caml-list] Recursive subtyping issue

2010-03-01 Thread David Allsopp
Goswin von Brederlow wrote: David Allsopp dra-n...@metastack.com writes: external foo_of_bar : bar - foo = %identity in *both* the .ml and .mli file for the module in question. I'm virtually certain that ocamlopt eliminates calls to the %identity primitive. Where is that documented

RE: [Caml-list] Recursive subtyping issue

2010-03-01 Thread David Allsopp
Guillaume Yziquel wrote: David Allsopp a écrit : snip external foo_of_bar : bar - foo = %identity in *both* the .ml and .mli file for the module in question. I'm virtually certain that ocamlopt eliminates calls to the %identity primitive. yziq...@seldon:~$ grep magic /usr/lib/ocaml

RE: [Caml-list] OCaml on Maemo

2010-02-25 Thread David Allsopp
matter once it's fixed in 3.12.0 (as you say). Martin DeMello wrote: On Wed, Feb 24, 2010 at 9:44 PM, David Allsopp dra-n...@metastack.com wrote: My shiny new Nokia N900 has finally arrived so, of course, having got bash, vim and texlive successfully installed I naturally need a compiler

[Caml-list] OCaml on Maemo

2010-02-24 Thread David Allsopp
My shiny new Nokia N900 has finally arrived so, of course, having got bash, vim and texlive successfully installed I naturally need a compiler! Before I dig into trying to compile OCaml on Maemo 5, can I ask if anyone else out there has already tried (and hopefully succeeded)? David

RE: [Caml-list] Problem with try_lock on win32.

2010-01-27 Thread David Allsopp
Romain Beauxis: I have a problem with the following code under win32: let m = Mutex.create () let () = Mutex.lock m; if Mutex.try_lock m then Printf.printf locked !\n else Printf.printf could not lock!\n This code is behaving correctly for a Windows mutex (AFAIK - I

RE: [Caml-list] Queue.fold give wrong order?

2010-01-19 Thread David Allsopp
Tom Wilkie wrote: Dear all Is Queue.fold going over items in the wrong order? It says equivalent to List.fold_left but I would expect the behaviour to be, when inserting items 1, then 2, then 3 a fold would be given items in that order? Is there a good reason for this? Could be have a

RE: [Caml-list] 2147483648l 2147483647l

2010-01-19 Thread David Allsopp
Goswin von Brederlow wrote: David Allsopp dra-n...@metastack.com writes: Matej Kosik wrote: I am sorry, I have a stupid question. I would like to ask if this: # 2147483648l 2147483647l;; - : bool = true The bug is in fact: # 2147483648l;; - : int32 = -2147483648l

RE: [Caml-list] Compatibility 3.11.1 and 3.09.3

2010-01-18 Thread David Allsopp
Michel Levy wrote: I have byte-code produced by ocamlc version 3.11.1 which does not work with ocamlrun version 3.09.3. Is this situation normal ? Afraid so. Must I have exactly the same version for the compiler producing the byte-code and the ocamlrun executing this code ? Yes - even

RE: [Caml-list] problem creating .cma library

2010-01-08 Thread David Allsopp
Guillaume Yziquel: Basile STARYNKEVITCH a écrit : Why do these functions not follow the usual CAMLparam/CAMLreturn macro stuff? Because they are written by the Ocaml guys (Damien knows really well the Ocaml garbage collector; he wrote it). And also, because these particular

RE: [Caml-list] 2147483648l 2147483647l

2010-01-05 Thread David Allsopp
Matej Kosik wrote: I am sorry, I have a stupid question. I would like to ask if this: # 2147483648l 2147483647l;; - : bool = true The bug is in fact: # 2147483648l;; - : int32 = -2147483648l and given that behaviour, the above result makes sense! But... it cannot be encoded

RE: [Caml-list] [ANN] Release Candidate: 3.11.2+rc1

2009-12-30 Thread David Allsopp
Damien Doligez wrote: It is our pleasure to announce that the release of 3.11.2 is imminent. What we need now is your cooperation for testing the release candidate, especially on Windows. I've managed to compile this RC on Windows 7 x64 using the MinGW 32-bit port (with ocaml-calendar 2.02,

RE: [Caml-list] How to write a CUDA kernel in ocaml?

2009-12-15 Thread David Allsopp
Basile Starynkevitch wrote: Eray Ozkural wrote: Compiling Ocaml to efficient C is not easy and probably impossible (or extremely difficult) in the general case. In particular, tail recursive calls are essential in Ocaml, and are not available in C in most compilers. What's this based on

RE: [Caml-list] Module abbreviation

2009-12-15 Thread David Allsopp
Ashish Agarwal wrote: If you only have a file ast.mli, you should not be able to write Ast.Sig because you do not have a module named Ast. This isn't true - the include statement works at a type system level (because you're dealing with a signature) and therefore only a .cmi file is required. It

RE: [Caml-list] Same name fields

2009-11-21 Thread David Allsopp
Mykola Stryebkov wrote: I'm trying to declare to record types with fields having the same name but different types. This is not possible with record types (at the same module scope) - when you declare the second type you obscure the previous type. snip If I declare type ta second -

RE: [Caml-list] The lexer hack

2009-11-10 Thread David Allsopp
I'm creating a parser for a LaTeX-ish language that features verbatim blocks. Out of interest, how LaTeX-ish do you mean? I would hazard a guess that it's impossible to parse an unrestricted TeX file using an LR grammar (or at least no more clear than a hand-coded automaton) because you have

RE: [Caml-list] compiling C library wrapper

2009-11-05 Thread David Allsopp
Aaron Bohannon wrote: I am quite confused by the whole process of compiling and installing wrappers for C libraries. It seems like I can get things to work OK without really knowing what I'm doing if everything is put and built in a single directory. The hard part seems to be putting the

RE: [Caml-list] Howto execute a command without the cmd windows opening?

2009-11-04 Thread David Allsopp
The problem is that a c:\windows\system32\cmd.exe windows pops up: I'd like to avoid this. Both Sys.command and Unix.system use cmd in order to provide command line parsing (it gives the closest equivalent to the Unix version - except for the usual quoting weirdness of cmd as compared to bash!)

RE: [Caml-list] Howto execute a command without the cmd windows opening?

2009-11-04 Thread David Allsopp
If i find a way to read the exit status of the process… Pass a PROCESS_INFORMATION structure to CreateProcess (in order to get the hProcess for the process you created) and then use GetExitCodeProcess[1]. You can use WaitForSingleObject passing hProcess to it if you need to block until the

RE: [Caml-list] Constructors are not functions

2009-10-09 Thread David Allsopp
Goswin von Brederlow wrote: snip Then what about type t1 = Bar of int * int type t2 = Foo of (int * int) If you treat constructors as functions taking one argument then But why (so arbitrarily) do this? t1: int * int - t1 t2: int * int - t2 If you look at each type definition and

RE: [Caml-list] Improving OCaml's choice of type to display

2009-10-09 Thread David Allsopp
Le 9 oct. 09 à 16:18, Damien Guichard a écrit : Imagine my code is:     type color = int     let black : color = 0    Then, following your proposition, evaluating black should give me an int rather than a color because int is shorter and therefore nicer. Hmm, I'd say that having OCaml

RE: [Caml-list] Constructors are not functions

2009-10-06 Thread David Allsopp
Is there a reason for constructors not to behave like functions? For instance, one cannot make a partial application from a constructor: This is how SML handles constructors, Xavier explained the reasons he chose to depart from this in:

RE: [Caml-list] Constructors are not functions

2009-10-06 Thread David Allsopp
David Allsopp wrote: Is there a reason for constructors not to behave like functions? For instance, one cannot make a partial application from a constructor: This is how SML handles constructors, Xavier explained the reasons he chose to depart from this in: http://caml.inria.fr/pub/ml

RE: [Caml-list] Constructors are not functions

2009-10-06 Thread David Allsopp
Jon Harrop wrote: David Allsopp wrote: I think it would be possible to simulate the SML behaviour in OCaml using camlp4 (if you assume that for [type foo = Bar of int] that future unbound references to [bar] are interpreted as [fun x - bar x] instead of an error) Only if you turned

RE: [Caml-list] Dynlink and ocamlfind for camlp4 3.11?

2009-10-05 Thread David Allsopp
I tried, and it works fine until the require of json-static. It breaks when loading pcre.cma. Now we can say that pcre package has some problem, but dynlink is loaded successfully. Hmm - a few other things to check: 1. Are you definitely using Cygwin's PCRE and which version (run pcre-config

RE: [Caml-list] Dynlink and ocamlfind for camlp4 3.11?

2009-10-05 Thread David Allsopp
Conglun Yao wrote: Thanks for all of your help. Unfortunately, it still does not work. It is really nightmare to use camp4 in a windows machine. In this instance, it's very much Cygwin that's causing the problem, rather than Windows! I didn't realise that Cygwin's Dynlink only extended to

RE: [Caml-list] Missing the cmi files required to use toplevellib.cma

2009-10-01 Thread David Allsopp
The problem is : most of the usefull types and functions are installed in the toplevellib.cma but I can't use this without the proper cmi files (I need config.cmi for cmi_magic_number, printtyp.cmi and typemod.cmi for printing signatures, but env.cmi would be nice to have as well for

RE: [Caml-list] Generation of Java code from OCaml

2009-09-24 Thread David Allsopp
Mykola Stryebkov wrote: Hi, Richard. On 23 Вер 2009, at 22:57, Richard Jones wrote: snip I'm going to use stringing bits of text together. But text generating is not an issue here. The issue is how to make this stringing driven by description of ocaml records. camlp4 would be the

RE: [Caml-list] External DLL call with mingw OCaml

2009-09-20 Thread David Allsopp
Matthieu Dubuget wrote: Hello, recently, I had to call a third-party DLL (Windows, mingw flavour of OCaml). It was not easy, because of symbol names decorations (I think). It is indeed not easy - fortunately, it's a once-only thing (for each DLL) I'd like to know if there is a more simple

RE: [Caml-list] Sets and home-made ordered types

2009-09-17 Thread David Allsopp
Matthias Puech wrote: David Allsopp a écrit : Is it not possible to model your requirement using Map.Make instead - where the keys represent the equivalence classes and the values whatever data you're associating with them? Yes, that's exactly the workaround I ended up using, although

RE: [Caml-list] probability of some events

2009-09-09 Thread David Allsopp
Are you aware of such future changes in OCaml, that would lead to incompatibility? With the usual caveat that past performance is not an indicator of future wealth... In the last few years, the only change which caused a bit of an uproar was camlp4 between 3.09 and 3.10 (which was totally

RE: [Caml-list] Why don't you use batteries?

2009-09-05 Thread David Allsopp
Rakotomandimby Mihamina wrote: 09/04/2009 09:37 PM, Gaius Hammond: I am after a language that has the rapid-development of Python or Tcl but with type safety; OCaml is right now the best bet, but it is *very* rough around the edges. The way you install ActivePython is you download it and

RE: [Caml-list] Windows Vista/7 specific functions

2009-09-02 Thread David Allsopp
Hi Reed, Having hacked away with the Win64 port before I thought I’d have a go. The first thing I noticed is that Microsoft have finally released the x86 and x64 compilers in the same package (this was a pain if you wanted to build MSVC and MSVC64 ports as you needed two

RE: [Caml-list] lazy vs fun

2009-08-25 Thread David Allsopp
ri...@happyleptic.org wrote: Oops. The following makes it possible for f to be garbage-collected: ...? Because the fact that the fun calls f does not count as a reference ? The anonymous function in the second version of Martin's function doesn't call [f] (at least directly): imagine if

RE: [Caml-list] Re: ocaml sefault in bytecode: unanswered questions

2009-08-09 Thread David Allsopp
Ivan Chollet wrote: See the following snippet: # let q = Queue.create () in   Queue.push 0 q;   q == q;; - : bool = true Standard behavior. Now let see this: # let q = Queue.create () in   Queue.push 0 q; q = q;; which hangs for ever... Internally, Queues are a cyclic data

RE: [Caml-list] Re: ocaml sefault in bytecode: unanswered questions

2009-08-08 Thread David Allsopp
When you pass a value to a function, you create a pointer to that value in the OCaml runtime - the GC can't collect the old value until List.iter completes because the value is still live (internally, it's part of a local root but, in practice, as List.iter is implemented in OCaml directly it's

RE: [Caml-list] windows, threads and sockets

2009-08-07 Thread David Allsopp
Christoph Bauer wrote: snip I'm not quite sure what is going on, but my best bet is this: the main loop waits for the sockets with Unix.select listOfSockets [] [] timeout One socket is the listener socket on which new connections are made. Unix.select returns a list of sockets. Initially

RE: [Caml-list] Callbacks from C to OCaml

2009-07-11 Thread David Allsopp
ygrek wrote: On Fri, 10 Jul 2009 12:16:17 +0100 David Allsopp dra-n...@metastack.com wrote: Now, at any time, the SCM may invoke the ServiceCtrlHandler function registered with it. This also needs to callback to an OCaml function to work out what to do (the closure was registered

[Caml-list] Callbacks from C to OCaml

2009-07-10 Thread David Allsopp
I'm having some trouble with a library wrapping Windows Services - I'm wondering if anyone can shed some light on possible pitfalls with the mechanism for C callbacks while I continue to scratch my head! Although my problem is with a Windows-based solution my overall question is about C-callbacks

RE: [Caml-list] ocamlgraph

2009-06-25 Thread David Allsopp
You need to say #directory ocamlgraph;; Before you #use your file so that the toploop can find graph.cmi David From: caml-list-boun...@yquem.inria.fr [mailto:caml-list-boun...@yquem.inria.fr] On Behalf Of Ligia Nistor Sent: 25 June 2009 18:00 To:

[Caml-list] OCaml MinGW 64-bit Port

2009-06-01 Thread David Allsopp
Has anyone had a go at building OCaml using the 64-bit beta of the MSYS tools[1]? David [1] http://sourceforge.net/projects/mingw-w64/ ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list

RE: [Caml-list] Width subtyping

2009-06-01 Thread David Allsopp
Dario Teixeira wrote: Thanks -- that is also an interesting solution. I'm guessing it will be faster, though it might consume more memory in cases where only one field is actually used. I'll have to try it side-by-side with the object based solution to see how they compare in the real world

RE: [Caml-list] Width subtyping

2009-05-29 Thread David Allsopp
Though it is probably been-there-done-that material for the veterans in this list, for the sake of the not-so-veterans I have to ask: how do you guys typically model width subtyping in Ocaml? Definitely not a veteran, but might private types help a little? Consider for example three record

RE: [Caml-list] findlib with MinGW

2009-05-19 Thread David Allsopp
I built OCaml 3.11.0/MinGW with findlib on Windows 7 RC a few days ago. I found that while my Cygwin installer doesn't install its own OCaml on Windows Vista by default, for some reason on Windows 7 it installs loads more software in the default install! Is Cygwin's OCaml definitely not

RE: [Caml-list] Call for translators of the Unix system programming course

2009-05-13 Thread David Allsopp
Mihamina Rakotomandimby wrote: I am volunteer to be reviewer. However, I think it should not be a criteria to be a mother tongue english for many reason: Non mother tongue english people use simple english and does not understand very advanced english. Mother tongue english are tempted to

RE: [Caml-list] Re: Ocamlopt code generator question

2009-05-05 Thread David Allsopp
Sylvain Le Gall wrote: Maybe this point can be discussed. I think 3 ports for windows is a bit too much... I don't know Dimitry point of view, but maybe INRIA can just consider MSVC (or mingw). If this is a way to free INRIA resources, it is a good option. There are actually 4 Windows ports

RE: [Caml-list] Threads?

2009-04-23 Thread David Allsopp
It's been about 5 years since I faced this situation. I'm trying to link my program against the Thread module. Things go well until I do the ocamlopt compilation, then it aborts the make with the message: ocamlfind ocamlopt -thread -o sdsp.opt   -package camlp4 -package threads -package unix -I

RE: [Caml-list] Building pcre-ocaml on OCaml 3.11.0 on MinGW

2009-04-23 Thread David Allsopp
Hi David, David Allsopp wrote: I've just had an enlightening few hours getting pcre-ocaml to compile under Windows ... The main thing that's got me puzzled is the renaming of libpcre.dll.a and libpcre.a that I have to do to get the thing to link. Thanks for investigating

[Caml-list] Using Dynlink in the top level

2009-04-15 Thread David Allsopp
Is there any way to allow modules loaded with Dynlink in the top-level to have access to modules loaded using #load? For example, suppose I have bar.cmo which depends on foo.cmo. If I say: Objective Caml version 3.11.0 # #load dynlink.cma;; # #load foo.cmo;; # Dynlink.openfile bar.cmo;;

RE: [Caml-list] (no subject)

2009-04-08 Thread David Allsopp
Alain Frisch wrote: DESMONS Bertrand wrote: It is really strange for me... 'ls' recognizes liblapack.a, but I don't see it using 'dir' ... ? There is also no liblapack.a.lnk, but isn't that due to the fact that liblapack.a is a symbolic link? Try dir /a - perhaps the attributes on the

RE: [Caml-list] RE: flexlink + lacaml (lapack)

2009-04-08 Thread David Allsopp
Bertrand Desmons wrote: I followed your trick and now compilation is OK. Excellent - good to know that the trick is consistent for other libraries too! Just a remark however (maybe it's the key for the porblem): when renaming the old 'liblapack.a', Windows asked me a confirmation, arguing

[Caml-list] Using camlp4 syntax extensions in the top-level

2009-02-25 Thread David Allsopp
I'm trying to use json-static in the toplevel (OCaml 3.11.0 / MinGW / findlib 1.2.4) but I'm getting an error message: # #camlp4o;; C:\Dev\OCaml\lib\dynlink.cma: loaded C:\Dev\OCaml\lib\camlp4: added to search path C:\Dev\OCaml\lib\camlp4\camlp4o.cma: loaded Camlp4 Parsing version 3.11.0

[Caml-list] Building pcre-ocaml on OCaml 3.11.0 on MinGW

2009-02-20 Thread David Allsopp
I've just had an enlightening few hours getting pcre-ocaml to compile under Windows (I tried a few years ago and, very lazily, just gave up). I've managed to get it to work but I'm wondering whether anyone else has done this and, if so, whether they can explain/confirm/correct a couple of the

RE: [Caml-list] Defining a family of functors

2009-01-29 Thread David Allsopp
On the other hand, it was pointed to me that Alain already wrote a compiler patch implementing first-class modules. That's right. I have two questions - the first of which will probably demonstrate my lack of skill with the OCaml module system. 1. Does first-class modules, as with

RE: [Caml-list] What is a future of ocaml?

2009-01-15 Thread David Allsopp
Jacques Garrigue wrote: The reason is mostly wrong :-) That'll teach me to comment on type theory on this list :o) And neither polymorphic variants nor object require type anotations in ocaml; they just make it much more painful to understand error messages. Though I'm confused by this - I

RE: [Caml-list] What is a future of ocaml?

2009-01-14 Thread David Allsopp
Dawid Toton wrote: Could anybody explain why it's impossible to have type classes in OCaml? I don't think it's impossible - but I believe that if you introduce type classes then you damage Hindley-Milner type inference and you can no longer derive a principal typing for an arbitrary ML

RE: [Caml-list] Parsing simple type expressions

2009-01-06 Thread David Allsopp
ocamlyacc - you can get most of it for free out of parsing/parser.mly in the OCaml sources... the section on type expressions starts at line 1144 for OCaml 3.11.0. David -Original Message- From: caml-list-boun...@yquem.inria.fr [mailto:caml-list- boun...@yquem.inria.fr] On Behalf

RE: [Caml-list] [ANN] OCamlSpotter: OCaml compiler extension for source browsing, version 1.0

2008-12-26 Thread David Allsopp
Jun Furuse wrote: snip Sorry, but I do not think so: include List let g = length ocamlc 3.11.0 with -annot never informs about length, included from List. This is why a compiler patch is required at least for version 3.11.0. This is a bug and should be reported in Mantis -

RE: [Caml-list] vim OCaml-syntax: wrong indentation...

2008-12-24 Thread David Allsopp
C:\head -10 c:\vim\vim72\indent\ocaml.vim Vim indent file Language: OCaml Maintainers: Jean-Francois Yuen jfy...@happycoders.org Mike Leary le...@nwlink.com Markus Mottl markus.mo...@gmail.com URL:

RE: [Caml-list] Freeze in 64-bit Windows Num module

2008-12-17 Thread David Allsopp
I’m seeing the same thing... David From: caml-list-boun...@yquem.inria.fr [mailto:caml-list-boun...@yquem.inria.fr] On Behalf Of Reed Wilson Sent: 17 December 2008 06:53 To: caml-list@yquem.inria.fr Subject: [Caml-list] Freeze in 64-bit Windows Num module Hi guys, I have an

RE: [Caml-list] Accessing constructors (tags) from C

2008-11-23 Thread David Allsopp
See Section 18.3.4 of the manual. In your example below, Null is an integer 0 and Int is a 1-word block with tag 1. In C, Null is Val_int(0) and t = Int(x) is caml_alloc(1, 1); Store_field(t, 0, Val_int(x)). In general, the first constructor is 0 and so on in the order specified in the type

RE: [Caml-list] Native dynlink on 3.11: a request for packagers

2008-11-21 Thread David Allsopp
On 22 November 2008 01:20 Jon Harrop wrote: On Friday 21 November 2008 23:45:34 Dario Teixeira wrote: Hi, Does ocamlfind support any of this? Since I'm now also cross-compiling OCaml, I've certainly come to appreciate findlib more than ever. Indeed it does. The current version

RE: [Caml-list] open Module (not?) considered harmful

2008-11-20 Thread David Allsopp
On 20 November 2008 10:49, Stefano Zacchiroli wrote: On Thu, Nov 20, 2008 at 10:33:03AM +, Richard Jones wrote: Encouraging developers to open modules is also usually a bad idea, except in very limited circumstances (hello Printf). Why? You and others failed me to convince of this. Or,

RE: [Caml-list] Private types

2008-11-01 Thread David Allsopp
Edgar Friendly wrote: Jacques Garrigue wrote: Your intuition is correct that it would theoretically be possible to try subtyping in place of unification in some cases. The trouble is that thoses cases are not easy to specify (so that it would be hard for the programmer to known when he

RE: [Caml-list] Private types

2008-11-01 Thread David Allsopp
Edgar Friendly wrote: David Allsopp wrote: Without the full coercion for x you'll get a type error because the type checker infers that the type of the [if] expression is [t] from the [then] branch and then fails to unify [ `B of int ] with [t] unless the type of [x] is first coerced

RE: [Caml-list] Private types

2008-10-30 Thread David Allsopp
Daniel Bünzli wrote: Le 30 oct. 08 à 21:18, David Allsopp a écrit : Shouldn't I now be able to say: string_of_int x;; I don't think so. According to the manual [1] the only thing you can do on private types is pattern match or project their fields. I doesn't mean your type can

RE: [Caml-list] ocamlopt performance in 3.11

2008-10-20 Thread David Allsopp
Andrew Varon wrote: On Oct 17, 2008, at 5:59 AM, David Allsopp wrote: Pleased to say that I've got my 3 current projects compiled and running under 3.11+beta1 Unfortunately for one of the projects, its reference run (a computationally intensive, repeatable operation the speed

  1   2   >