Browse thread
[Caml-list] ocaml 3.07 and optional arguments
- Vincent Barichard
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Vincent Barichard <Vincent.Barichard@i...> |
| Subject: | [Caml-list] ocaml 3.07 and optional arguments |
Hi all,
I've just downloaded ocaml 3.07 and compil it. But when I try to compil old
programs, I encounter some problems with optional arguments in methods.
In fact I have the following method in a class called Solution:
method scalarizingFunction ?weightVector' referenceSolution =
match weightVector' with
None -> self#doScalarizingFunction referenceSolution
| Some y -> self#doScalarizingFunction' y referenceSolution
where referencePoint is a Solution.cPoint type object, and weighVector' a
Solution.weightVector type object.
and in another source file, I have the call:
let newScalarizingFunctionValue =
(sol#scalarizingFunction : ?weightVector':Solution.cWeightVector -> Solution
cPoint -> float) referencePoint in .....
With ocaml 3.06, It compiles fine, but with ocaml 3.07 I'va got the
following error:
ocamlc -I ../Common -I ../Exact -I ../TS -I ../SA -I ../EA -I ../HGA -g -pp
camlp4o unix.cma -c ../SA/mOSA.ml
File "../SA/mOSA.ml", line 64, characters 135-149:
This expression has type
Solution.cPoint =
< augment : Solution.cPoint -> Solution.cPoint -> unit;
compare : Solution.cPoint -> Global.comparison; copy : Solution.cPoint
distance : Solution.cPoint ->
Solution.cPoint -> Solution.cPoint -> float;
get_OV : int -> float; get_OV_size : int;
linearScalarizingFunction : Solution.cWeightVector ->
Solution.cPoint -> float;
load : char Stream.t -> unit;
minmaxScalarizingFunction : Solution.cWeightVector ->
Solution.cPoint -> float;
save : out_channel -> unit; set_OV : int -> float -> unit >
but is here used with type
?weightVector':Solution.cWeightVector -> Solution.cPoint
make: *** [../SA/mOSA.cmo] Error 2
Is there any changes with the use of optional arguments for methods ?
I didn't find any clue in the ocaml 3.07 documentation.
Thanks you for your help.
Vincent
-------------------
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