Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: David Monniaux <monniaux@tulip.csl.sri.com>
To: caml-list@inria.fr
Subject: inheritance for functor ?
Date: Thu, 3 Sep 1998 22:53:05 -0700 (PDT)	[thread overview]
Message-ID: <199809040553.WAA25004@csla.csl.sri.com> (raw)
In-Reply-To: <35E3C6E9.BAFFE611@univ-savoie.fr>

Christophe Raffalli writes:

 > module type Euclidian_Ring =
 >   sig
 >    import Ring
 >    type nt
 >     val norm : t -> nt
 >     val leq : nt -> nt -> bool
 >     val (//) : t -> t -> t
 >     val (mod) : t -> t -> t
 >     val div_mod : t -> t -> t * t
 >   end

inherit would not add another keyword.

Such a feature looks highly desirable (especially for examples such as
yours, with mathematical structures). Also, it looks easy to implement.

High fives to the implementors for let module = ... in ...

Remark: it's not possible to hide a 'new classtype' function in a
signature. That looks useful in certain circumstances, like mlgtk with
its classes taking a pointer into a C structure as a
parameter. However, this is not a must at all; after all, the library
user is supposed to be big enough to understand that some functions
shouldn't be used, period.

Now about mlgtk. I've recently had demands for it. I plan to add all
the gtk library functions and the data structure accessors as soon as
possible. Partial versions will be posted on my WWW page
(http://www.eleves.ens.fr:8080/home/monniaux).

Talking of which, what are the perspectives on variances? In ML-gtk, I
have classes such as button, label, all descending from
widget. Certain functions take a widget list as an argument. The
problem is that the user has to do the casts manually:

[((foobar constructing a button) :> widget);
 ((foobar constructing a label) :> widget)]

which is quite heavy. Is there any way to make it look better?

-- 
David Monniaux, PhD student at ENS, Paris, France
Now at: Computer science laboratory  SRI International
        Formal methods group         Menlo Park, CA, US
http://www.csl.sri.com/~monniaux





  reply	other threads:[~1998-09-04  7:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-08-26  8:27 Christophe Raffalli
1998-09-04  5:53 ` David Monniaux [this message]
1998-09-04 13:36   ` Jerome Vouillon

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=199809040553.WAA25004@csla.csl.sri.com \
    --to=monniaux@tulip.csl.sri.com \
    --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