caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] which ocaml build system
       [not found] <51ECF4EB.1060301@libertysurf.fr>
@ 2013-07-22  9:07 ` r.3
  2013-07-22 15:11   ` Ashish Agarwal
  2013-07-23 13:39   ` Marek Kubica
  0 siblings, 2 replies; 15+ messages in thread
From: r.3 @ 2013-07-22  9:07 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 1602 bytes --]

Hello, 

I have a new question : which package build system ? 

I would like to gather thoughts on that in the ocaml.org website, because actually its advice is 'make + OcamlMakefile' and 'Omake', and I am not sure it is the best advice. 


I think that people maintaining opam and godi may have important opinions on that. Here are my personal thoughts on this. 


1) pur ocaml, 1 platform (1 person, or a team with identical computers and systems) 

ocamlbuild because : 
official tool that comes with ocaml, very handy and powerful, quite easy, clear _tags file that shows well dependencies, and support for ocamlfind. 
I espetially like the feature that handles dependencies properly and only rebuilds what is needed when rebuilding. 

I also tried Makefiles without OcamlMakefile, autotools (with ocaml-autoconf) 



2) ocaml with c dependencies, multi platforms, cross builds 

Here the best thing I found was autotools with ocaml-autoconf. 
Though autotools are not easy to handle, that was the tool for the job. lablgtk, cairo-ocaml use this for example. 

I also tried Omake but really did not like it, as we have to learn a full new "language" with many special instructions. Also, I did not succeeded in patching an Omake project (caml-images) for cross compilation. The complexity is maybe equivalent as with autotools, but learning autotools is much more rewarding as it is a reference build system for GNU builds in particular. 
Oasis looked interesting, but was not able to cross compile, and I had more confidence in autotools for multi platforms support. 


Best regards, 
William R 


[-- Attachment #2: Type: text/html, Size: 2106 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Caml-list] which ocaml build system
  2013-07-22  9:07 ` [Caml-list] which ocaml build system r.3
@ 2013-07-22 15:11   ` Ashish Agarwal
  2013-07-23 13:39   ` Marek Kubica
  1 sibling, 0 replies; 15+ messages in thread
From: Ashish Agarwal @ 2013-07-22 15:11 UTC (permalink / raw)
  To: r.3; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 452 bytes --]

On Mon, Jul 22, 2013 at 5:07 AM, <r.3@libertysurf.fr> wrote:

ocaml.org website, because actually its advice is 'make + OcamlMakefile'
> and 'Omake', and I am not sure it is the best advice.
>

I've created an issue to update the tutorial you're referring to:
https://github.com/ocaml/ocaml.org/issues/167

In general, all the tutorials need work, as stated on the main tutorials
page:
http://ocaml.org/tutorials/index.html

Contributions are welcome.

[-- Attachment #2: Type: text/html, Size: 1099 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Caml-list] which ocaml build system
  2013-07-22  9:07 ` [Caml-list] which ocaml build system r.3
  2013-07-22 15:11   ` Ashish Agarwal
@ 2013-07-23 13:39   ` Marek Kubica
  2013-07-25 21:45     ` Martin DeMello
  1 sibling, 1 reply; 15+ messages in thread
From: Marek Kubica @ 2013-07-23 13:39 UTC (permalink / raw)
  To: r.3; +Cc: caml-list

Hello William,

I very much appreciate your effort to create more documetation for the
ocaml.org site!

On Mon, 22 Jul 2013 11:07:33 +0200 (CEST)
r.3@libertysurf.fr wrote:

> I would like to gather thoughts on that in the ocaml.org website,
> because actually its advice is 'make + OcamlMakefile' and 'Omake',
> and I am not sure it is the best advice. 

I suppose this advice used to be good, but today maybe not as much
anymore.

> ocamlbuild because : 
> official tool that comes with ocaml, very handy and powerful, quite
> easy, clear _tags file that shows well dependencies, and support for
> ocamlfind. I espetially like the feature that handles dependencies
> properly and only rebuilds what is needed when rebuilding.

Also, OASIS can directly create a _tags file, which makes it probably
the easiest system to deploy.

In my opinion, this works pretty decent even when extending OCaml with
C modules.

> I also tried Omake but really did not like it, as we have to learn a
> full new "language" with many special instructions. Also, I did not
> succeeded in patching an Omake project (caml-images) for cross
> compilation. The complexity is maybe equivalent as with autotools,
> but learning autotools is much more rewarding as it is a reference
> build system for GNU builds in particular. Oasis looked interesting,
> but was not able to cross compile, and I had more confidence in
> autotools for multi platforms support. 

Omake has a pretty nice feature to recompile the files automatically on
changes, thus you have a workflow that does not feature explicit
compilation. Very useful, since the OCaml compiler is reasonably fast.
I wish other systems would adopt this. I often write shellscripts that
do similar things with inotifywait, but an integrated solution would be
great.

I also agree that the Omake language is… odd. Maybe not more odd than
Makefiles, but Makefiles are common and well understood, whereas Omake
is kinda obscure.

regards,
Marek

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Caml-list] which ocaml build system
  2013-07-23 13:39   ` Marek Kubica
@ 2013-07-25 21:45     ` Martin DeMello
  2013-07-26  1:10       ` Francois Berenger
                         ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Martin DeMello @ 2013-07-25 21:45 UTC (permalink / raw)
  To: Marek Kubica; +Cc: r.3, caml-list

On Tue, Jul 23, 2013 at 6:39 AM, Marek Kubica <marek@xivilization.net> wrote:
>
>> I would like to gather thoughts on that in the ocaml.org website,
>> because actually its advice is 'make + OcamlMakefile' and 'Omake',
>> and I am not sure it is the best advice.
>
> I suppose this advice used to be good, but today maybe not as much
> anymore.

I have an old (and fairly small) project that I've tried at least
thrice to migrate off OcamlMakefile to something more
modern/ocaml-specific, and failed each time (after spending 1-2
evenings on it). I'll give it another go and report back on my
experience, but at least historically OCamlMakefile was the easiest
thing to get up and running.

You can see the pretty simple makefile here:
https://github.com/martindemello/varix/blob/master/makefile - I can't
remember exactly what difficulties I had with ocamlbuild and omake
now.

martin

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Caml-list] which ocaml build system
  2013-07-25 21:45     ` Martin DeMello
@ 2013-07-26  1:10       ` Francois Berenger
  2013-07-26  5:01         ` Malcolm Matalka
  2013-07-26  4:49       ` Gabriel Scherer
  2013-07-27  9:51       ` [Caml-list] which ocaml build system Goswin von Brederlow
  2 siblings, 1 reply; 15+ messages in thread
From: Francois Berenger @ 2013-07-26  1:10 UTC (permalink / raw)
  To: caml-list

On 07/26/2013 06:45 AM, Martin DeMello wrote:
> On Tue, Jul 23, 2013 at 6:39 AM, Marek Kubica <marek@xivilization.net> wrote:
>>
>>> I would like to gather thoughts on that in the ocaml.org website,
>>> because actually its advice is 'make + OcamlMakefile' and 'Omake',
>>> and I am not sure it is the best advice.
>>
>> I suppose this advice used to be good, but today maybe not as much
>> anymore.
>
> I have an old (and fairly small) project that I've tried at least
> thrice to migrate off OcamlMakefile to something more
> modern/ocaml-specific, and failed each time (after spending 1-2
> evenings on it). I'll give it another go and report back on my
> experience, but at least historically OCamlMakefile was the easiest
> thing to get up and running.
 >
> You can see the pretty simple makefile here:
> https://github.com/martindemello/varix/blob/master/makefile - I can't
> remember exactly what difficulties I had with ocamlbuild and omake
> now.

How is the parallelization of the build with OCamlMakefile?

Is it good (i.e. faster than ocamlbuild)?

F.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Caml-list] which ocaml build system
  2013-07-25 21:45     ` Martin DeMello
  2013-07-26  1:10       ` Francois Berenger
@ 2013-07-26  4:49       ` Gabriel Scherer
  2013-08-05 17:34         ` [Caml-list] character syntax error '^M' r.3
  2013-07-27  9:51       ` [Caml-list] which ocaml build system Goswin von Brederlow
  2 siblings, 1 reply; 15+ messages in thread
From: Gabriel Scherer @ 2013-07-26  4:49 UTC (permalink / raw)
  To: Martin DeMello; +Cc: Marek Kubica, r.3, caml-list

> You can see the pretty simple makefile here:
> https://github.com/martindemello/varix/blob/master/makefile - I can't
> remember exactly what difficulties I had with ocamlbuild and omake
> now.

We all love ocamlbuild exercises in the morning!

First, I was unable to build your project using the makefile on my
machine (simple 3.12.1 OCaml with Debian package), because of the mix
of libs that now use Camlp4, and Ledit code integrated into your
project. I took the quick route, removed dependency on ledit code
(by removing the relevant target from your makefile) and replaced the
code of the "let readline prompt" function of varix.ml by an "assert
false". Then your makefile succeeded in compiling the program
(that is, once I added a META file to the aurochs sources for
aurochs_lib).

Porting this working makefile to ocamlbuild was then extremely easy.

(1) You use the following ocamlfind packages:

  PACKS = unix bigarray str mikmatch_pcre pcre batteries aurochs_lib

to which correspond the following line in a _tags file:

  true: package(unix), package(bigarray), package(str), \
        package(mikmatch_pcre), package(pcre), package(batteries), \
        package(aurochs_lib)

(remember to compile with "ocamlbuild -use-ocamlfind" to enable direct
ocamlfind use; otherwise you'll get a build error with these)

(you may want to be a tad more specific about which modules of your
code use which packages; or at least you now have the possibility to
be more specific.)

(2) I had to ask ocamlbuild not to look into the ledit/ directory to
avoid hygiene complaints. Again in _tags

  "ledit": -traverse

(3) You use camlp4 preprocessing. Again in _tags:

  true: syntax(camlp4o)

(4) You have a rule to build a .ml from a .peg:

  vx.ml: vx.peg
  	aurochs -target ml vx.peg

ocamlbuild doesn't support aurochs out-of-the-box, so we need to add
a new rule in a myocamlbuild.ml plugin. This looks like the beginning
of bad news (nobody likes to write myocamlbuild.ml plugins), but the
Google link for "ocamlbuild plugin" brought me to

  http://brion.inria.fr/gallium/index.php/Using_alphaCaml_with_ocamlbuild

which is *exactly* your use-case (building a .ml/.mli pair from an
external tool). I copy-pasted the plugin code in the link above,
adapting it lightly:

  open Ocamlbuild_plugin;;
  open Command;;

  let alphaCaml = A"aurochs";;

  dispatch begin function
    | After_rules ->
        rule "aurochs: peg -> ml"
          ~prods:["%.ml"; "%.mli"]
          ~dep:"%.peg"
        begin fun env _build ->
          Cmd(S[alphaCaml; A"-target"; A"ml"; P(env "%.peg")])
        end;
    | _ -> ()
  end

Note that the makefile rule says you only produce a .ml, but aurochs
in fact produce a .ml and .mli. I initially only had ~prods:["%.ml"]
because I believed the makefile, and that caused a build failure.

(5) Voilà:

  ocamlbuild -use-ocamlfind varix.native

If you're tired of adding -use-ocamlfind each time, you can also add

  Options.use_ocamlfind := true;;

to myocamlbuild.ml



The META I added to aurochs and the changes I did to varix are
available at:
  https://github.com/gasche/aurochs
  https://github.com/gasche/varix

Note that I have no particular opinion on which build system *you*
should be using -- probably the one that you find most convenient.

On Thu, Jul 25, 2013 at 11:45 PM, Martin DeMello
<martindemello@gmail.com> wrote:
> On Tue, Jul 23, 2013 at 6:39 AM, Marek Kubica <marek@xivilization.net> wrote:
>>
>>> I would like to gather thoughts on that in the ocaml.org website,
>>> because actually its advice is 'make + OcamlMakefile' and 'Omake',
>>> and I am not sure it is the best advice.
>>
>> I suppose this advice used to be good, but today maybe not as much
>> anymore.
>
> I have an old (and fairly small) project that I've tried at least
> thrice to migrate off OcamlMakefile to something more
> modern/ocaml-specific, and failed each time (after spending 1-2
> evenings on it). I'll give it another go and report back on my
> experience, but at least historically OCamlMakefile was the easiest
> thing to get up and running.
>
> You can see the pretty simple makefile here:
> https://github.com/martindemello/varix/blob/master/makefile - I can't
> remember exactly what difficulties I had with ocamlbuild and omake
> now.
>
> martin
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Caml-list] which ocaml build system
  2013-07-26  1:10       ` Francois Berenger
@ 2013-07-26  5:01         ` Malcolm Matalka
  2013-07-26  5:46           ` Adrien Nader
  0 siblings, 1 reply; 15+ messages in thread
From: Malcolm Matalka @ 2013-07-26  5:01 UTC (permalink / raw)
  To: Francois Berenger; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 1656 bytes --]

make -j<number > should work.
On Jul 26, 2013 3:10 AM, "Francois Berenger" <berenger@riken.jp> wrote:

> On 07/26/2013 06:45 AM, Martin DeMello wrote:
>
>> On Tue, Jul 23, 2013 at 6:39 AM, Marek Kubica <marek@xivilization.net>
>> wrote:
>>
>>>
>>>  I would like to gather thoughts on that in the ocaml.org website,
>>>> because actually its advice is 'make + OcamlMakefile' and 'Omake',
>>>> and I am not sure it is the best advice.
>>>>
>>>
>>> I suppose this advice used to be good, but today maybe not as much
>>> anymore.
>>>
>>
>> I have an old (and fairly small) project that I've tried at least
>> thrice to migrate off OcamlMakefile to something more
>> modern/ocaml-specific, and failed each time (after spending 1-2
>> evenings on it). I'll give it another go and report back on my
>> experience, but at least historically OCamlMakefile was the easiest
>> thing to get up and running.
>>
> >
>
>> You can see the pretty simple makefile here:
>> https://github.com/**martindemello/varix/blob/**master/makefile<https://github.com/martindemello/varix/blob/master/makefile>- I can't
>> remember exactly what difficulties I had with ocamlbuild and omake
>> now.
>>
>
> How is the parallelization of the build with OCamlMakefile?
>
> Is it good (i.e. faster than ocamlbuild)?
>
> F.
>
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/**arc/caml-list<https://sympa.inria.fr/sympa/arc/caml-list>
> Beginner's list: http://groups.yahoo.com/group/**ocaml_beginners<http://groups.yahoo.com/group/ocaml_beginners>
> Bug reports: http://caml.inria.fr/bin/caml-**bugs<http://caml.inria.fr/bin/caml-bugs>
>

[-- Attachment #2: Type: text/html, Size: 2727 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Caml-list] which ocaml build system
  2013-07-26  5:01         ` Malcolm Matalka
@ 2013-07-26  5:46           ` Adrien Nader
  2013-07-26  6:49             ` rixed
  0 siblings, 1 reply; 15+ messages in thread
From: Adrien Nader @ 2013-07-26  5:46 UTC (permalink / raw)
  To: Malcolm Matalka; +Cc: Francois Berenger, caml-list

Hi,

On Fri, Jul 26, 2013, Malcolm Matalka wrote:
> make -j<number > should work.

You depend on ocamldep however and it has some issues (it's a fairly
simple tool that can get things wrong).

NB: I'm not aware of something that doesn't depend on it and does
automatic dep discovery unfortunately (but maybe Merlin's approach to
handle partial files could help).

-- 
Adrien Nader

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Caml-list] which ocaml build system
  2013-07-26  5:46           ` Adrien Nader
@ 2013-07-26  6:49             ` rixed
  2013-07-26  7:07               ` David Allsopp
  0 siblings, 1 reply; 15+ messages in thread
From: rixed @ 2013-07-26  6:49 UTC (permalink / raw)
  To: caml-list

-[ Fri, Jul 26, 2013 at 07:46:58AM +0200, Adrien Nader ]----
> > make -j<number > should work.
> 
> You depend on ocamldep however and it has some issues (it's a fairly
> simple tool that can get things wrong).

Many makefiles have a distinct target for dependencies, which helps here
(iff the deps do not change very often). Phasing out ocamldep also helps
wrt recompilation speed.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [Caml-list] which ocaml build system
  2013-07-26  6:49             ` rixed
@ 2013-07-26  7:07               ` David Allsopp
  0 siblings, 0 replies; 15+ messages in thread
From: David Allsopp @ 2013-07-26  7:07 UTC (permalink / raw)
  To: caml-list

rixed@happyleptic.org wrote:
> -[ Fri, Jul 26, 2013 at 07:46:58AM +0200, Adrien Nader ]----
> > > make -j<number > should work.

Only if the Makefile has been written with parallel execution in mind - it's very easy to produce rules which have hidden dependencies encoded in the order of the prerequisites (and which can be darned hard to debug...). Personally, I'd never assume that a Makefile will automatically work with -j (though I do agree that build systems should be written for parallel execution from day 0).

> > You depend on ocamldep however and it has some issues (it's a fairly
> > simple tool that can get things wrong).
> 
> Many makefiles have a distinct target for dependencies, which helps here
> (iff the deps do not change very often). Phasing out ocamldep also helps
> wrt recompilation speed.

What do you mean by phasing out ocamldep? An alternate tool, handwritten dependencies (ouch) or something more complex?


David 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Caml-list] which ocaml build system
  2013-07-25 21:45     ` Martin DeMello
  2013-07-26  1:10       ` Francois Berenger
  2013-07-26  4:49       ` Gabriel Scherer
@ 2013-07-27  9:51       ` Goswin von Brederlow
  2 siblings, 0 replies; 15+ messages in thread
From: Goswin von Brederlow @ 2013-07-27  9:51 UTC (permalink / raw)
  To: caml-list

On Thu, Jul 25, 2013 at 02:45:02PM -0700, Martin DeMello wrote:
> On Tue, Jul 23, 2013 at 6:39 AM, Marek Kubica <marek@xivilization.net> wrote:
> >
> >> I would like to gather thoughts on that in the ocaml.org website,
> >> because actually its advice is 'make + OcamlMakefile' and 'Omake',
> >> and I am not sure it is the best advice.
> >
> > I suppose this advice used to be good, but today maybe not as much
> > anymore.
> 
> I have an old (and fairly small) project that I've tried at least
> thrice to migrate off OcamlMakefile to something more
> modern/ocaml-specific, and failed each time (after spending 1-2
> evenings on it). I'll give it another go and report back on my
> experience, but at least historically OCamlMakefile was the easiest
> thing to get up and running.
> 
> You can see the pretty simple makefile here:
> https://github.com/martindemello/varix/blob/master/makefile - I can't
> remember exactly what difficulties I had with ocamlbuild and omake
> now.
> 
> martin

I vote for oasis. Its kind of a meta build system in that it then
generates you a Makefile, configure, setup.ml, myocamlbuild.ml (in my
case) and _tags to do the actual building.

It can build libraries, packed and not packed, binaries and test
suites with verry little input. It generates META files for libs and
handles build dependencies on other libs or libs from part of the same
source. The generated files can also be extended in case you need
something oasis doesn't know about. Never had the need for that yet.

MfG
	Goswin

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Caml-list] character syntax error '^M'
  2013-07-26  4:49       ` Gabriel Scherer
@ 2013-08-05 17:34         ` r.3
  2013-08-05 17:38           ` David Allsopp
  0 siblings, 1 reply; 15+ messages in thread
From: r.3 @ 2013-08-05 17:34 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 543 bytes --]

Dear list, 

I got a new error with trunk version of ocaml. 

I have in a module a code that appears like that in emacs (which is used to convert files from dos to unix) : 
String.get s (String.length s -1) = '^M' 

The thing is that '^M' is actually the return character of windows (RET) 

This works with ocaml 4.00, but now, with trunk version of ocaml, it tells me this is a "syntax error". How shall I do ? what is supposed to be inside the ' ' ? 
The emacs command "describe-char" gives me this unicode : 0x0D 


Best regards, 
William 

[-- Attachment #2: Type: text/html, Size: 876 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Caml-list] character syntax error '^M'
  2013-08-05 17:34         ` [Caml-list] character syntax error '^M' r.3
@ 2013-08-05 17:38           ` David Allsopp
  2013-08-05 20:23             ` William R
  0 siblings, 1 reply; 15+ messages in thread
From: David Allsopp @ 2013-08-05 17:38 UTC (permalink / raw)
  To: r.3; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 762 bytes --]

Use \r or \x0d? http://caml.inria.fr/pub/docs/manual-ocaml/lex.html


David

On 5 Aug 2013, at 18:34, "r.3@libertysurf.fr<mailto:r.3@libertysurf.fr>" <r.3@libertysurf.fr<mailto:r.3@libertysurf.fr>> wrote:

Dear list,

I got a new error with trunk version of ocaml.

I have in a module a code that appears like that in emacs (which is used to convert files from dos to unix) :
String.get s (String.length s -1) = '^M'

The thing is that '^M' is actually the return character of windows (RET)

This works with ocaml 4.00, but now, with trunk version of ocaml, it tells me this is a "syntax error". How shall I do ? what is supposed to be inside the ' ' ?
The emacs command "describe-char" gives me this unicode : 0x0D


Best regards,
William

[-- Attachment #2: Type: text/html, Size: 2647 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Caml-list] character syntax error '^M'
  2013-08-05 17:38           ` David Allsopp
@ 2013-08-05 20:23             ` William R
  2013-08-06 10:52               ` David Allsopp
  0 siblings, 1 reply; 15+ messages in thread
From: William R @ 2013-08-05 20:23 UTC (permalink / raw)
  To: David Allsopp; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 881 bytes --]

perfect, thanks a lot!

On 08/05/2013 07:38 PM, David Allsopp wrote:
> Use \r or \x0d? http://caml.inria.fr/pub/docs/manual-ocaml/lex.html
>
>
> David
>
> On 5 Aug 2013, at 18:34, "r.3@libertysurf.fr 
> <mailto:r.3@libertysurf.fr>" <r.3@libertysurf.fr 
> <mailto:r.3@libertysurf.fr>> wrote:
>
>> Dear list,
>>
>> I got a new error with trunk version of ocaml.
>>
>> I have in a module a code that /appears/ like that in emacs (which is 
>> used to convert files from dos to unix) :
>> String.get s (String.length s -1) = '^M'
>>
>> The thing is that '^M' is actually the return character of windows (RET)
>>
>> This works with ocaml 4.00, but now, with trunk version of ocaml, it 
>> tells me this is a "syntax error". How shall I do ? what is supposed 
>> to be inside the ' ' ?
>> The emacs command "describe-char" gives me this unicode : 0x0D
>>
>>
>> Best regards,
>> William


[-- Attachment #2: Type: text/html, Size: 3652 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [Caml-list] character syntax error '^M'
  2013-08-05 20:23             ` William R
@ 2013-08-06 10:52               ` David Allsopp
  0 siblings, 0 replies; 15+ messages in thread
From: David Allsopp @ 2013-08-06 10:52 UTC (permalink / raw)
  To: caml-list

William R wrote:
> On 08/05/2013 07:38 PM, David Allsopp wrote:
> Use \r or \x0d? http://caml.inria.fr/pub/docs/manual-ocaml/lex.html
> 
> On 5 Aug 2013, at 18:34, "r.3@libertysurf.fr" <r.3@libertysurf.fr> wrote:
> Dear list,
> 
> I got a new error with trunk version of ocaml.
> 
> I have in a module a code that appears like that in emacs (which is used to convert files from dos to unix) :
> String.get s (String.length s -1) = '^M'
> The thing is that '^M' is actually the return character of windows (RET)

This is not strictly true. The return *sequence* of Windows is \r\n (0x0d followed by 0x0a). It's logical only if you imagine you're on a typewriter...

> This works with ocaml 4.00, but now, with trunk version of ocaml, it tells
> me this is a "syntax error".

The support for '^M' was removed as part of PR#5598 (http://caml.inria.fr/mantis/view.php?id=5598) in R12420 for parsing/lexer.mll. I'm not very good at interpreting subversion changelogs (for branches), but it looks like the fix may have only been applied to trunk (by mistake?) as it's certainly not in 4.00 or 4.00.1. However, I think looking at it that 4.01 does contain that patch (i.e. behaves the same way as trunk).


David


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-08-06 10:52 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <51ECF4EB.1060301@libertysurf.fr>
2013-07-22  9:07 ` [Caml-list] which ocaml build system r.3
2013-07-22 15:11   ` Ashish Agarwal
2013-07-23 13:39   ` Marek Kubica
2013-07-25 21:45     ` Martin DeMello
2013-07-26  1:10       ` Francois Berenger
2013-07-26  5:01         ` Malcolm Matalka
2013-07-26  5:46           ` Adrien Nader
2013-07-26  6:49             ` rixed
2013-07-26  7:07               ` David Allsopp
2013-07-26  4:49       ` Gabriel Scherer
2013-08-05 17:34         ` [Caml-list] character syntax error '^M' r.3
2013-08-05 17:38           ` David Allsopp
2013-08-05 20:23             ` William R
2013-08-06 10:52               ` David Allsopp
2013-07-27  9:51       ` [Caml-list] which ocaml build system Goswin von Brederlow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).