Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* problem with optional arguments
@ 2000-09-20 10:38 Dr. Wolfgang Gehrke
  2000-09-20 20:15 ` Remi VANICAT
  2000-09-21  0:08 ` Jacques Garrigue
  0 siblings, 2 replies; 4+ messages in thread
From: Dr. Wolfgang Gehrke @ 2000-09-20 10:38 UTC (permalink / raw)
  To: caml-list

Hello,

could someone advice me how to resolve the following problem:

The following works fine:

class test1 ~(a:int) () =
  object
    val a = abs a
    method a = a
    method strange x = new test1 ~a:x ()
  end

let t1 = new test1 ~a:(-10) ()

But on the other hand with an optional argument it does not compile,
neither:

class test2 ?(a:int) () =
  object
    val a = abs a
    method a = a
    method strange x = new test2 ~a:x ()
  end

nor in the form below:

class test3 ?(a:int) () =
  object
    val a = abs a
    method a = a
    method strange x = new test3 ?a:x ()
  end

I do need the use of "new" and do not want to use {<...>} since any new
instance internally changes a.

Thank you,
Wolfgang



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

end of thread, other threads:[~2000-09-21 19:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-09-20 10:38 problem with optional arguments Dr. Wolfgang Gehrke
2000-09-20 20:15 ` Remi VANICAT
2000-09-21 18:59   ` Gerd Stolpmann
2000-09-21  0:08 ` Jacques Garrigue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox