caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Vincent Barichard" <Vincent.Barichard@info.univ-angers.fr>
To: "CAML LIST" <caml-list@inria.fr>
Subject: [Caml-list] ocaml 3.07 and optional arguments
Date: Mon, 29 Sep 2003 20:13:17 +0200 (Paris, Madrid)	[thread overview]
Message-ID: <3F78763D.000003.03248@lanfeust> (raw)

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


             reply	other threads:[~2003-09-29 18:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-29 18:13 Vincent Barichard [this message]
2003-09-30  1:24 ` Jacques Garrigue
2003-09-30  3:07   ` Jacques Garrigue
2003-09-30  5:29     ` Vincent Barichard
2003-09-30 19:18 Arturo Borquez
2003-10-01  0:04 ` Jacques Garrigue
2003-10-01  8:43   ` Christophe Raffalli
2003-10-01 15:45     ` Yaron Minsky
2003-10-01 15:54       ` Alain.Frisch
2003-10-01 20:28 Arturo Borquez
2003-10-01 23:51 ` Jacques Garrigue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F78763D.000003.03248@lanfeust \
    --to=vincent.barichard@info.univ-angers.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).