From: David Allsopp <dra-news@metastack.com>
To: Ocaml Mailing List <caml-list@inria.fr>
Subject: RE: [Caml-list] Ocaml compiler documentation
Date: Thu, 3 Apr 2014 10:46:00 +0000 [thread overview]
Message-ID: <E51C5B015DBD1348A1D85763337FB6D9E0947428@Remus.metastack.local> (raw)
In-Reply-To: <20140403101410.GA3176@fuck_yeah>
Simon Cruanes wrote:
> Le Thu, 03 Apr 2014, David Allsopp a écrit :
> > Yotam Barnoy wrote:
> > > 2. What is demonstrated in lines 114-117 regarding polymorphic variant
> row fields:
> > >
> > > | Rtag of label * bool * core_type list
> > > (* [`A] ( true, [] )
> > > [`A of T] ( false, [T] )
> > > [`A of T1 & .. & Tn] ( false, [T1;...Tn] )
> > > [`A of & T1 & .. & Tn] ( true, [T1;...Tn] )
> > > *)
> > >
> > > What does the bool value represent?
> >
> > It indicates that the constructor is constant, or that one of the
> > types in the conjunction is "empty" (i.e. constant - I don't know what
> > Jacques' terminology for that is!)
>
> I might miss something, but wouldn't this be more readable if a variant
> was used instead of booleans? Say,
>
> type includes_constant =
> | IncludesConstant
> | DoesNotIncludeConstant
Possibly (it certainly can't make any difference for efficiency, as type bool is simply a two-constructor variant itself!). I guess historically the worry would be conflicting names between different types, but that's not a problem now.
> In addition, I never heard about conjunctions in variants, so I'm happy
> Yotam started this initiative...
+1!
I already knew about conjunctions (it is worth perusing that section of the manual as most, if not all, of the weird corner cases are covered in there somewhere) but not how it was implemented in the parser/type checker!
David
next prev parent reply other threads:[~2014-04-03 10:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-31 15:39 Yotam Barnoy
2014-03-31 17:06 ` Milan Stanojević
2014-03-31 17:51 ` Yotam Barnoy
2014-04-01 10:03 ` Mark Shinwell
2014-04-03 2:48 ` Yotam Barnoy
2014-04-03 6:18 ` Mark Shinwell
2014-04-03 8:42 ` Jeremy Yallop
2014-04-03 9:05 ` David Allsopp
2014-04-03 10:20 ` Simon Cruanes
2014-04-03 10:46 ` David Allsopp [this message]
2014-04-03 18:17 ` Yotam Barnoy
2014-04-03 9:10 ` Gabriel Scherer
2014-04-03 20:16 ` Alain Frisch
2014-04-04 7:39 ` François Bobot
2014-04-14 6:12 ` Mark Shinwell
2014-04-14 7:44 ` Alain Frisch
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=E51C5B015DBD1348A1D85763337FB6D9E0947428@Remus.metastack.local \
--to=dra-news@metastack.com \
--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