Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Sylvain BOULM'E" <Sylvain.Boulme@lip6.fr>
To: luther@dpt-info.u-strasbg.fr
Cc: caml-list@inria.fr
Subject: Re: Modules, type de modules et type polymorphes.
Date: Wed, 20 Sep 2000 15:45:07 +0200	[thread overview]
Message-ID: <200009201345.PAA06349@rana.lip6.fr> (raw)
In-Reply-To: Your message of "Tue, 19 Sep 2000 14:29:39 +0200." <20000919142939.A3312@lambda.u-strasbg.fr>

> Bonjour, ...
> Hello, ...
> 
> quel est le probleme de ceci ?
> 
> # module type T_A = sig
>     val string_of_a : 'a -> string
>   end;;
> module type T_A = sig val string_of_a : 'a -> string end
> # module A : T_A = struct 
>     let string_of_a = string_of_int
>   end;;
> Signature mismatch:

Bonjour,

Le probleme est que dans "T_A", on exige que "string_of_a" soit polymorphe. Or 
dans A, tu ne lui fournis qu'une fonction monomorphe !!
Qq'un qui utilise un module A de type T_A a le droit d'ecrire 
 "A.string_of_a true"
Ce qui provoquerait un segmentation fault avec ton implantation de A...

Je ne sais pas ceux que tu cherches a ecrire, mais qq chose comme ci-dessous 
serait peut-etre plus adapte :

module type T_A = 
 sig type t  val string_of_a : t -> string end

module A: (T_A with type t=int) =
 struct
   type t=int
   let string_of_a = string_of_int
 end

Sylvain.
-- 
Tel. prof : 01-44-27-88-35
Page web  : http://www-spi.lip6.fr/~boulme/




      parent reply	other threads:[~2000-09-20 19:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-09-19 12:29 Sven LUTHER
2000-09-19 18:16 ` Markus Mottl
2000-09-20  7:31 ` Jean-Christophe Filliatre
2000-09-20 13:45 ` Sylvain BOULM'E [this message]

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=200009201345.PAA06349@rana.lip6.fr \
    --to=sylvain.boulme@lip6.fr \
    --cc=caml-list@inria.fr \
    --cc=luther@dpt-info.u-strasbg.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