Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Jean-Baptiste Rouquier <jrouquiethearchiveshouldhaveafewantispamtricks@ens-lyon.fr>
To: caml-list <caml-list@inria.fr>
Subject: [Caml-list] Programming with classes
Date: Sat, 21 Aug 2004 03:57:18 +0200 (CEST)	[thread overview]
Message-ID: <1093053438.4126abfecddbe@mouette.ens-lyon.fr> (raw)
In-Reply-To: <1093051727.29139.1503.camel@pelican.wigram>

Quoting skaller:
>There is a further step: constructors. Never export
>class constructors. They must be wrapped in a normal
>Ocaml function which returns an abstract class type.

I would be glad to follow this rule, since I'm experiencing aesthetical problems
with constructors (see below). But could you develop a bit on this ?

My problem is that I'm exporting many class constructors (if you explain me why
I shouldnt, the next version probably won't) with similar argument types :
class type ['a] foo = object ... end
class foo_int : int -> string -> [int] foo
class foo_float : float -> string -> [float] foo
class ['a] foo_option : 'a wrappers -> 'a option -> string -> ['a option] foo
...

The actual class constructors have more arguments, so I'd like to define a sort
of polymorphic class specification and then avoid to repeat the arguments. The
aim is to have clearer documentation. I was considering wrapping it all into
functions but it's pure stub code.
Suggestions ?


Thanks,
-- 
Jean-Baptiste Rouquier

-------------------
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:[~2004-08-21  1:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-20 11:28 [Caml-list] Programming with modules Erik de Castro Lopo
2004-08-20 11:45 ` Richard Jones
2004-08-20 11:59   ` Benjamin Geer
2004-08-20 11:59   ` Erik de Castro Lopo
2004-08-20 12:09     ` Richard Jones
2004-08-27 16:29     ` Richard Jones
2004-08-20 14:47 ` Brian Hurt
2004-08-20 16:56   ` brogoff
2004-08-21  1:28     ` skaller
2004-08-21  1:57       ` Jean-Baptiste Rouquier [this message]
2004-08-21  2:44         ` [Caml-list] Programming with classes skaller

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=1093053438.4126abfecddbe@mouette.ens-lyon.fr \
    --to=jrouquiethearchiveshouldhaveafewantispamtricks@ens-lyon.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