Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* default arguments in classes
@ 2009-06-16 21:12 Jacques Le Normand
  2009-06-16 22:06 ` [Caml-list] " Paolo Donadeo
  2009-06-16 22:34 ` Martin Jambon
  0 siblings, 2 replies; 3+ messages in thread
From: Jacques Le Normand @ 2009-06-16 21:12 UTC (permalink / raw)
  To: caml-list caml-list

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

Hello list,
I'm trying to define a method with a default argument, but I keep getting an
error. Here's the code:

class foo  =
  object (self)
    method bar ?(baz="moo") () =
    (new foo)#bar ~baz ()
  end

and the error:

The expression "new foo" has type foo but is used with type
  < bar : baz:string -> unit -> 'a; .. >
Types for method bar are incompatible

how do I fix this?
cheers
--Jacques L.

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

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

end of thread, other threads:[~2009-06-16 22:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-16 21:12 default arguments in classes Jacques Le Normand
2009-06-16 22:06 ` [Caml-list] " Paolo Donadeo
2009-06-16 22:34 ` Martin Jambon

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