coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: "Soegtrop, Michael" <michael.soegtrop AT intel.com>
- To: "coq-club AT inria.fr" <coq-club AT inria.fr>
- Subject: RE: [Coq-Club] module "best practices"?
- Date: Thu, 23 Aug 2018 10:21:24 +0000
- Accept-language: de-DE, en-US
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=michael.soegtrop AT intel.com; spf=Pass smtp.mailfrom=michael.soegtrop AT intel.com; spf=None smtp.helo=postmaster AT mga11.intel.com
- Ironport-phdr: 9a23:KGFIABIZNbdS9JRiiNmcpTZWNBhigK39O0sv0rFitYgeLvjxwZ3uMQTl6Ol3ixeRBMOHs60C07KempujcFRI2YyGvnEGfc4EfD4+ouJSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47xaFLIv3K98yMZFAnhOgppPOT1HZPZg9iq2+yo9JDffwdFiCChbb9uMR67sRjfus4KjIV4N60/0AHJonxGe+RXwWNnO1eelAvi68mz4ZBu7T1et+ou+MBcX6r6eb84TaFDAzQ9L281/szrugLdQgaJ+3ART38ZkhtMAwjC8RH6QpL8uTb0u+ZhxCWXO9D9QLYpUjqg8qhrUgflhicZOTAk7GHZhM9+jKxZrxKguxNwzIHabZqJNPVleq7RYc8WSXZDU8tXSidPApm8b4wKD+cZM+pWso79qEUBrRuiHwmsA/vvxidVjXHx3K01z+QhHhvY0wwkEd4FrXPZrND0NKgOUeC61rfHzTHZY/NN3jfy9ofIcgw7ofGLRbJ9asvRyU8zFwzbilWcs5DqPzSQ1ukUtWWQ8uRuVeWqi2E9qgFxpCCixsYqionVmI0VzkrI+jhnz4szONa2S1Z7bMa5HJZUqS2WLYt7T8M4T2xopio20LkLtJCjcCQXyZkqyQTTZvKJfoSS/B7uWuKcLS1liH9mZL6znwu+/Emkx+HmSMW50FlHojBbntXWq3wA1ADf586aQfVn5EihwyyA1wXL5+FEP080ka3bJoYkwr4/jJUfrFnPEjX3mEXwkK+ZaEEk9vK05OTgZ7Xqvp6cN4lqhQHiKqkih8iyDfoiPgUOX2WX4+Sx2KP58UD9TrhGlvg2nbPYsJDeK8QbvKm5AwpN34Ym6hawEzem384GknkDNl5FYxWHgJbmO1HSOvD4Cu+/jk+tkDdt2/DJILnhDo/RIXjElbftZax95FJEyAov0dBf4IpZBa0GIPLqQ0P+qNjYDgIiPAGv2ObmCNB91psEVm6VA6+ZNrnSsV6S6e41LemMftxdhDGoYfMi/rvliWIzsV4bZ6igm5UNIjjsFfN/Zk6dfHDEg9EbEG5MsBBoH8Lwj1jXGwVUanmuRaUkonkeCYmmBIrHDMj5hb2K3C62GttNYW1JFkqLCV/pcZmJX7EHbyfEcZwpqSANSbX0E9xp7hqprgKvk+M2fNqRwTURsNfY7PYw4uTSkR8o8jktVpac1X2ASyd/mWZaHmZqjpA6mlR0zxK46YY9m+ZRTIUB5vVVXwN8PpnZnbQjVoLCHznZd9LMc26IB9WrBTZoEYA0zNZXOgB8HcmvilbI2C/4W7I=
Dear Samuel,
thanks for working this out! One question: from the link you sent before I
guess that you also experimented with records instead of modules. Could you
comment on your experience?
I agree that including module types in modules is a strange concept, but
since it supports the idea of putting the interface of a module into a module
type, I wouldn't call it heretic ;-) What would be cleaner is if a module is
declared to have some module type, that then it includes all definitions from
the module type automatically (both with transparent and opaque ascription,
since it is part of the interface). This is how I mentally interpret what I
am doing, even though I do the import explicitly.
Regarding your questions in the "module type functor method section":
(* Question: We could also have declared "L: Lang", and then do
Module Import LInst := L P.
instead of "Import L". What's the difference? *)
I think it is the same (but I didn't check the module typing rules). I would
do the partial module type functor application of LANG only if P would not be
an argument of the module but be a module which is instantiated in the body
of the module. That is if P would not be part of the interface of the module,
but an abstractable implementation detail. Such things do happen in practice.
But in this case I would clearly say L : LANG P.
(* Quirk/Question: Can we avoid having one module instantiation
Yes, you can write:
Module Combination(Import P: PARAMETERS_NAT_NAMES)(Import L: LANG P).
(* Quirk/Question: Why do I have to repeat all these definitions?
There's nothing unknown or unspecified. *)
As I wrote before, it would be nice if the module type ascription would
automatically include definitions. This would solve this.
Following my rules the definitions wouldn't belong in a module type, since
they are not part of a non abstractable module interface. What happens is
that by specialization you split a module type into a part which should still
be a module type and a part which should be a module. If I have such cases, I
split them up in two module types, so that by specialization one can stay a
module type and the other can become a module.
I have to think about if there is a more elegant solution.
Maybe we should do a feature request to have the "include definitions in
module type ascription". I guess not that many people are using definitions
in module types, so likely it would break little code.
Best regards,
Michael
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
- RE: [Coq-Club] module "best practices"?, (continued)
- RE: [Coq-Club] module "best practices"?, Soegtrop, Michael, 08/18/2018
- Re: [Coq-Club] module "best practices"?, Samuel Gruetter, 08/18/2018
- RE: [Coq-Club] module "best practices"?, Soegtrop, Michael, 08/19/2018
- Re: [Coq-Club] module "best practices"?, Kevin Hamlen, 08/20/2018
- RE: [Coq-Club] module "best practices"?, Soegtrop, Michael, 08/20/2018
- Re: [Coq-Club] module "best practices"?, Benjamin C. Pierce, 08/20/2018
- RE: [Coq-Club] module "best practices"?, Soegtrop, Michael, 08/23/2018
- Re: [Coq-Club] module "best practices"?, Benjamin C. Pierce, 08/20/2018
- RE: [Coq-Club] module "best practices"?, Soegtrop, Michael, 08/20/2018
- Re: [Coq-Club] module "best practices"?, Kevin Hamlen, 08/20/2018
- RE: [Coq-Club] module "best practices"?, Soegtrop, Michael, 08/19/2018
- Re: [Coq-Club] module "best practices"?, Adam Chlipala, 08/21/2018
- Re: [Coq-Club] module "best practices"?, Kevin Hamlen, 08/21/2018
- Re: [Coq-Club] module "best practices"?, Samuel Gruetter, 08/22/2018
- RE: [Coq-Club] module "best practices"?, Soegtrop, Michael, 08/23/2018
- Re: [Coq-Club] module "best practices"?, David Holland, 08/23/2018
- Re: [Coq-Club] module "best practices"?, Anders Lundstedt, 08/24/2018
- RE: [Coq-Club] module "best practices"?, Soegtrop, Michael, 08/24/2018
- Re: [Coq-Club] module "best practices"?, Anders Lundstedt, 08/24/2018
- Re: [Coq-Club] module "best practices"?, David Holland, 08/23/2018
- RE: [Coq-Club] module "best practices"?, Soegtrop, Michael, 08/23/2018
- Re: [Coq-Club] module "best practices"?, Samuel Gruetter, 08/22/2018
- Re: [Coq-Club] module "best practices"?, Kevin Hamlen, 08/21/2018
Archive powered by MHonArc 2.6.18.