From: Leo White <leo@lpw25.net>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Why is the parameter of a type declaration a coretype?
Date: Mon, 26 Oct 2015 09:33:56 -0400 [thread overview]
Message-ID: <1445866436.896754.420384249.0777C325@webmail.messagingengine.com> (raw)
In-Reply-To: <562E28A4.4020009@tu-berlin.de>
It used to be a string option, but I changed it at some point. The
fundemental reason is that whilst it is syntactically an optional string
(optional because of "_"), semantically it is a core_type. For
example:
type 'a t = T of 'b
constraint 'a = 'b list
is essentially equivalent to (using made-up syntax):
type 'b list t = T of 'b
This manifests as the params field in the *typed* AST being the
typed equivalent of core_type. It is slightly more convenient in
some places if the typed and untyped ASTs agree about such
things so the untyped AST uses a core type as well.
Regards,
Leo
On Mon, 26 Oct 2015, at 09:20 AM, Christoph Höger wrote:
> I am writing a syntax extension for OCaml and the following puzzles me:
>
> and type_declaration =
> {
> ptype_name: string loc;
> ptype_params: (core_type * variance) list;
> ^^^^^^^^^
>
> Why is a type-parameter a core_type and not just a string? What is the
> meaning of a non-variable parameter?
>
>
> --
> Christoph Höger
>
> Technische Universität Berlin
> Fakultät IV - Elektrotechnik und Informatik
> Übersetzerbau und Programmiersprachen
>
> Sekr. TEL12-2, Ernst-Reuter-Platz 7, 10587 Berlin
>
> Tel.: +49 (30) 314-24890
> E-Mail: christoph.hoeger@tu-berlin.de
>
> --
> Caml-list mailing list. Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
prev parent reply other threads:[~2015-10-26 13:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-26 13:20 Christoph Höger
2015-10-26 13:33 ` Leo White [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=1445866436.896754.420384249.0777C325@webmail.messagingengine.com \
--to=leo@lpw25.net \
--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