caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Pierre Weis <pierre.weis@inria.fr>
To: lvibert@irisa.fr (Laurent Vibert)
Cc: skaller@ozemail.com.au, pierre.weis@inria.fr,
	brogoff@speakeasy.net, caml-list@inria.fr
Subject: Re: [Caml-list] syntax of private constructors in CVS version
Date: Tue, 15 Jul 2003 10:22:19 +0200 (MET DST)	[thread overview]
Message-ID: <200307150822.KAA03389@pauillac.inria.fr> (raw)
In-Reply-To: <Pine.LNX.4.44.0307150956540.982-100000@cafe.irisa.fr> from Laurent Vibert at "Jul 15, 103 10:02:40 am"

> On Sun, 13 Jul 2003, John Max Skaller wrote:
> 
> > Pierre Weis wrote:
> > 
> > 
> > > Records with mutable fields are permitted. Mutators explicitely exported
> > > as functions are allowed, other mutations are forbidden.
> > 
> 
> So just a question : since mutations are forbidden, would it be safe to 
> relaxe the variance for mutable field, to allow something like
> 
> type +'a foo = private {mutable it : 'a}

No, since the field ``it'' is indeed mutable and can be mutated either
directly from within the module implementation, or indirectly via a
mutator function that would be exported in the interface.

In addition, the compiler has to know that field ``it'' is mutable, so
that it can take care of ``it'' fields in pattern matching (the
compiler must bind the contents of those field patterns to avoid bus
errors in the expression part of the corresponding clause).

Euh, if you really want a field to be treated as not mutable, just
define it as immutable :)

Simple enough, isnt'it ?

Best regards,

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/


-------------------
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:[~2003-07-15  8:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-27 20:50 Shaddin Doghmi
2003-06-27 21:15 ` brogoff
2003-06-27 22:10   ` Shaddin Doghmi
2003-06-28  2:24     ` brogoff
2003-06-30 18:39       ` Pierre Weis
2003-06-30 19:00         ` Chris Hecker
2003-06-30 21:36           ` brogoff
2003-07-01 10:47           ` Pierre Weis
2003-07-01  7:43         ` Hendrik Tews
2003-07-01 10:37         ` Yaron M. Minsky
2003-07-01 10:51         ` Yaron M. Minsky
2003-07-01 17:05           ` Pierre Weis
2003-07-01 17:20             ` brogoff
2003-07-03 11:46         ` John Max Skaller
2003-07-07 22:31           ` Pierre Weis
2003-07-13  9:11             ` John Max Skaller
2003-07-15  8:02               ` Laurent Vibert
2003-07-15  8:22                 ` Pierre Weis [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=200307150822.KAA03389@pauillac.inria.fr \
    --to=pierre.weis@inria.fr \
    --cc=brogoff@speakeasy.net \
    --cc=caml-list@inria.fr \
    --cc=lvibert@irisa.fr \
    --cc=skaller@ozemail.com.au \
    /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;
as well as URLs for NNTP newsgroup(s).