From: Xavier Leroy <xleroy@pauillac.inria.fr>
To: Emmanuel.Engel@lri.fr (Emmanuel Engel)
Cc: caml-list@pauillac.inria.fr
Subject: Re: CSL questions
Date: Thu, 28 Sep 1995 16:28:23 +0100 (MET) [thread overview]
Message-ID: <199509281528.QAA06395@pauillac.inria.fr> (raw)
In-Reply-To: <199509251101.MAA00575@newsun8.lri.fr> from "Emmanuel Engel" at Sep 25, 95 12:01:55 pm
> 1) Why cslc and cslopt don't print part of the source
> to explain where is error.
Correct. I finally noticed that during batch compilation it's
basically useless to print source fragments with the errors
underlined: since you're compiling from a file, you'll have to open it
with an editor and go to the line with the error anyway; you'll locate
the error inside the editor, not on the output of the compiler.
For Emacs users, the best solution is still to compile under Emacs
with M-x compile, then use find-next-error to jump to the error
location.
> How can I recursivly define modules ? I need SetExpr to define
> the type expr and I need the type expr to define SetExpr.
You can't. That's one of the most annoying restrictions of SML-style
module systems. Unfortunately, compiling mutually recursive module
definitions is hard. Some workarounds are described in the user's
manual (chapter "Batch compilation", section "Common errors". I'm
afraid they won't apply in your example, though.
> 3) If I suppress the case AC_op in my definition I still have some problems.
The Set.Make functor requires a type named "t" in its argument; just
provide it:
type expr = V of int
| Binop of expr * expr
| A_op of expr list
module SetExpr =
Set.Make(struct type t = expr let compare = compare end)
By the way, there's no need to write all these signature constraints
by hand, the system will do the right thing if you don't put them;
moreover, over-constraining may cause some types to become abstract
when you don't want them to.
> So I try to use the "with" constuct
There is a misunderstanding here: "with" does not rename type fields,
it adds an equality over an existing type field. So if S is
sig type t ... end
then S with t = expr is
sig type t=expr ... end
but not
sig type expr ... end
- Xavier Leroy
prev parent reply other threads:[~1995-09-29 8:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1995-09-25 11:01 Emmanuel Engel
1995-09-28 15:28 ` Xavier Leroy [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=199509281528.QAA06395@pauillac.inria.fr \
--to=xleroy@pauillac.inria.fr \
--cc=Emmanuel.Engel@lri.fr \
--cc=caml-list@pauillac.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