Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Compilation problem in OCAML 3.02 and 3.04
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <xavier.leroy@i...>
Subject: Re: [Caml-list] Compilation problem in OCAML 3.02 and 3.04
> I am a student in Computer Science in the University of Evry (France),
> and I tried to compile a simple ocaml program :
> 
> let rec fact = function
> 0 -> 1 | n-> n*(fact(n-1));;
> 
> Unfortunately, the "ocamlopt 1fact.ml" command gave me the following
> answer :
> 
> I think this is due to the name of the program, 1fact.ml, which should
> not begin with a number, because when I renamed the file fact1.ml it
> worked perfectly.

Correct.  The name of a Caml compilation unit is derived from its
source file name (e.g. fact1.ml --> Fact), and must be a valid Caml
identifier.

> Is it normal?

Well, it could be argued that the compiler should check the file names
and emit a more descriptive error than the one you obtained.  But
since you understood the problem perfectly well and found the fix
yourself... :-)

- Xavier Leroy
-------------------
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