caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Virgile Prevosto <virgile.prevosto@m4x.org>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Private type syntax and error message
Date: Fri, 12 Sep 2008 16:37:55 +0200	[thread overview]
Message-ID: <20080912163755.4b1f0201@is005115> (raw)
In-Reply-To: <78095.20041.qm@web54605.mail.re2.yahoo.com>

Hello,

Le ven 12 sep 2008 07:19:54 CEST,
Dario Teixeira <darioteixeira@yahoo.com> a écrit :

> 
> Btw, the code works on 3.11 CVS!
> 
Yes, this is a feature scheduled to be added in 3.11. in 3.10.x, only
variant and records can be made private. 

Le ven 12 sep 2008 15:43:19 CEST,
Colonna Francois <f.colonnacesari@free.fr> a écrit :

> # type my_int = private int;;
> 
> I get the message : "This fixed type is not an object or variant"
> 
> 1. The message is very obscure
> 2. why this syntax is not implemented as it should be ?
The syntax seems to be implemented as what the documentation says.
See http://caml.inria.fr/pub/docs/manual-ocaml/manual021.html#htoc99: 
"Private types

type-representation	::=	...  
 	∣	 = private constr-decl  { | constr-decl }  
 	∣	 = private { field-decl  { ; field-decl } }
"
i.e. at the moment you can write 'type foo = private A of int'
or 'type bar = private { a of int }'
but not directly 'type my_int = private int'
(IIRC, there are some technical reasons linked to the internal
representation of ocaml syntax tree for that) 
As said above, you have to wait (or try the cvs version) for ocaml 3.11
to be able to declare any type definition as private.
-- 
E tutto per oggi, a la prossima volta.
Virgile


      reply	other threads:[~2008-09-12 14:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-12 13:43 Colonna Francois
2008-09-12 15:01 ` [Caml-list] " Colonna Francois
2008-09-12 15:04 ` Jon Harrop
2008-09-12 14:19   ` Dario Teixeira
2008-09-12 14:37     ` Virgile Prevosto [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=20080912163755.4b1f0201@is005115 \
    --to=virgile.prevosto@m4x.org \
    --cc=caml-list@yquem.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;
as well as URLs for NNTP newsgroup(s).