Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Damien <Damien.Pous@ens-lyon.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] functors and objects
Date: Thu, 5 Feb 2004 09:55:12 +0100	[thread overview]
Message-ID: <20040205095512.62ef577d.Damien.Pous@ens-lyon.fr> (raw)
In-Reply-To: <20040204115745J.garrigue@kurims.kyoto-u.ac.jp>

On Wed, 04 Feb 2004 11:57:45 +0900 Jacques Garrigue wrote:

> The closest I can see to what you ask for is
> 
> module type O = sig
>   type t
>   val as_o : t -> o
> end
> ...
> 
> This isn't a problem of soundness.
> There is just no such thing as a "partially abstract" object type.
there is no such thing...
...in the type system or in the compiler ?

Sorry for mixing variants and objects again, 
but I have got the feeling that since the example I posted with variants
works, the first example with objects could/should work :
It seems quite natural and reasonable. So why should it be rejected...

I don't really see what can prevent the compiler to do it.
It looks like an additional check in the type checker,
and almost nothing in the compiler
(that's just a feeling, I never looked at ocamlc sources...)

> But as shown above, you can easily simulate it by coupling an abstract
> type with a coercion to an object type.
still curious : are such "coercion identity functions" eliminated by the
compiler ?
 
> Note however that it would be probably simpler to turn your functors
> into parameterized classes: then you can specify constraints on the
> parameters with #-types.
yes, the project is currently written with classes like
['reactor] obj 
['obj] reactor

I was just wondering whether the  class "reactor"
could be translated into a module, since it is instantiated only once.

cheers,
damien

-------------------
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-02-05  8:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-03 18:06 Damien
2004-02-03 19:37 ` Matt Gushee
2004-02-03 19:39 ` [Caml-list] functors and objects' Matt Gushee
2004-02-03 20:26   ` Damien Pous
2004-02-04  2:57 ` [Caml-list] functors and objects Jacques Garrigue
2004-02-05  8:55   ` Damien [this message]
2004-02-05  9:18     ` Jacques Garrigue
2004-02-05 13:45       ` Damien
2004-02-06  1:30         ` Jacques Garrigue

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=20040205095512.62ef577d.Damien.Pous@ens-lyon.fr \
    --to=damien.pous@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