From: Tom Hirschowitz <tom.hirschowitz@inria.fr>
To: caml-list@inria.fr
Subject: [Caml-list] Forward references
Date: Fri, 4 Oct 2002 08:46:04 +0000 [thread overview]
Message-ID: <15773.21836.500915.522180@paille.inria.fr> (raw)
Hi Brian,
in your example, the current structure of types would not allow
to express how Set.Make uses its arguments.
Nothing ensures you that the body of Set.Make does not make use
of cmp.
It is in fact exactly the same problem for the right-hand sizes
of let rec, as in
let rec f x y = compare (x, y) (y, x)
and u = A.g f 1 2
One could imagine a type system telling you whether A.g inspects
the value of its arguments or not (in fact Xavier and I did imagine
such a type system, article is on our web pages).
But without this, A.g could apply f, which would make the computation
go wrong.
This said, even in the context of a type system where those dependency
problems are solved, it is not trivial that types do not cause new
problems. We don't think so but are not sure. I tried to formalize
this idea and implemented an early prototype type-checker for caml
with mixin modules, which used this idea. My conclusion was that the
theory was in to early stage for a prototype to be really significant.
> I'm curious as to whether types could also be forward declared, or deferred,
> as well, and if this forward ref machinery could deal with the problem of
> instantiating a functor which is in a recursive relationship with a type, as in
> the following faux-Caml
>
> forward type composite = { data : string ; children : CompositeSet.t }
> and cmp x y = Pervasives.compare x.data y.data
> and module CompositeSet = Set.Make(struct type t = composite let compare = cmp end)
>
> This is a lighter approach than the one involving MoscowML recursive
> modules, since there is no extra module wrapper, but can probably be transformed
> into the mosml style mechanically. Is there some showstopper that prevents this
> (admittedly half baked) approach from being feasible?
>
> I'd really like to see some solution to the above mentioned problems in
> OCaml sooner rather than later.
>
> -- Brian
>
>
> -------------------
> 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
>
-------------------
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
next reply other threads:[~2002-10-04 8:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-04 8:46 Tom Hirschowitz [this message]
2002-10-06 16:34 ` brogoff
-- strict thread matches above, loose matches on Subject: below --
2002-10-03 23:58 brogoff
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=15773.21836.500915.522180@paille.inria.fr \
--to=tom.hirschowitz@inria.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