From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 8BB107EF5E for ; Sat, 16 Jul 2016 11:59:15 +0200 (CEST) IronPort-PHdr: 9a23:WucfWhVyrq5RyVij7/AGkaabKcvV8LGtZVwlr6E/grcLSJyIuqrYZxCBt8tkgFKBZ4jH8fUM07OQ6PG4HzBdqs/c4DgrS99lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUiv2OQc9HOnpAIma153xjLHqvcGOKFwV1HKUWvBbFF2OtwLft80b08NJC50a7V/3mEZOYPlc3mhyJFiezF7W78a0+4N/oWwL46pyv+YJa6jxfrw5QLpEF3xmdjltvIy4gyLeVhOC7WcwVWAfkxwAQ1SUrUKyYpCk+BP3qvZwwmGze4XLV7M5VT2mpe8/UBb1kiQKOzc92G7Sg810yqlcpUTl7zxyxYLOYYLdHv15e+uJfd4cSXBAXe5NUDRGA8WkaIwWSeEGOLALgZP6og5EswG5GQC2GaXqxhdHg3b32esx1OFrWVXYxgs8FsgT9nHYhNrwPaYWF+uyyf+bnn34c/pK1GKlu8DzeRc7rKTJAOt9 Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=vrotaru.md@gmail.com; spf=Pass smtp.mailfrom=vrotaru.md@gmail.com; spf=None smtp.helo=postmaster@mail-wm0-f54.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of vrotaru.md@gmail.com) identity=pra; client-ip=74.125.82.54; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="vrotaru.md@gmail.com"; x-sender="vrotaru.md@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of vrotaru.md@gmail.com designates 74.125.82.54 as permitted sender) identity=mailfrom; client-ip=74.125.82.54; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="vrotaru.md@gmail.com"; x-sender="vrotaru.md@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-wm0-f54.google.com) identity=helo; client-ip=74.125.82.54; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="vrotaru.md@gmail.com"; x-sender="postmaster@mail-wm0-f54.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BjAAAOBYpXhjZSfUpchBV8pz2GQ4V0hQSBeSKFeAKBKTgUAQEBAQEBAQERAQEBCAsLCSEvgjIEARKCEwEBBAESEQQZARsSCwEDAQsGBQQHDQ0dAgIhAQERAQUBChIGARISEIdzAQMPCA6hO4ExPjGLO4FqgloFhE8KGScDClKDTAEBAQEBAQQBAQEBAQEBAQEBFQIGEIUieIRNgkOCKoJUgloFhlYMkg40AYYShjGCG4I5jH2IJYY6MIEPDw+CUoFXPDKHYwEBAQ X-IPAS-Result: A0BjAAAOBYpXhjZSfUpchBV8pz2GQ4V0hQSBeSKFeAKBKTgUAQEBAQEBAQERAQEBCAsLCSEvgjIEARKCEwEBBAESEQQZARsSCwEDAQsGBQQHDQ0dAgIhAQERAQUBChIGARISEIdzAQMPCA6hO4ExPjGLO4FqgloFhE8KGScDClKDTAEBAQEBAQQBAQEBAQEBAQEBFQIGEIUieIRNgkOCKoJUgloFhlYMkg40AYYShjGCG4I5jH2IJYY6MIEPDw+CUoFXPDKHYwEBAQ X-IronPort-AV: E=Sophos;i="5.28,372,1464645600"; d="scan'208,217";a="184973231" Received: from mail-wm0-f54.google.com ([74.125.82.54]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 16 Jul 2016 11:58:50 +0200 Received: by mail-wm0-f54.google.com with SMTP id i5so58171723wmg.0 for ; Sat, 16 Jul 2016 02:58:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+I9fSkrPBYT5m3wKHy+R4dkDLFoB4c2fcsGbNE3siJc=; b=YFloCo5L+UtPOSQ1BoXP4oJ2vEIeVkDOB+w+dhs9oBIBYMytBBfKXrfHHSOkVahzpz UAB7A3NiZyxvdQY/OMMiRQUizutylqGYrVQEmrfcwDaDQHAUSQ3O3PT4iJqoTvGAjue4 np/wfbljYBeqg96C3g87SM++wkaBsDk0PQi62H7uWePuJhH3vU48CstApyIQp5AP1Uuv xOuXBNLYMjbGZ5rMjCg8QKVZwMwJzP2V054ljBUSo2KiwziUTKxcT9Q5EMdhPfF6lIB3 J3PqiGtcrsKjHEc6oJGpUatFVWAJ0V1seDtjfbsJlhYP1Qhb3mdk4I4v2ziONnhjA8c0 JmWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+I9fSkrPBYT5m3wKHy+R4dkDLFoB4c2fcsGbNE3siJc=; b=S+4QmsMkXxvbGvzAqlaqUgZJ3vDj6wr9aDGpgp9e/lXrNQqWjUqph0jNPyhoc6q1EJ dnPmScOlwMelmhtF8zXwxSRfZEsnr9YabQ028oOpOaLq6s1ODG6o38VuDe7ozl7F2vu7 wSBMQkcWDhyQUBCfFokbL+OX91VipzpWvUncNpMrDWM0D98eN91dsYnMVPKbn64iCH+l hr+8PaMO7n+BX4cyjEqDgG1s80VnxQ7wsBw/c1dJrnQNBrhvL54ITp4JUw1259nNd9bo Yj7N7PSh0pA+91vzDmt0q2OqkvD+vyc9m11WlJGPFMrt7Vvak8NJRchzaiO6mc1mPhhW +H8w== X-Gm-Message-State: ALyK8tImIne4J5qC2+cB7QU18z/bpYn2MOS+AXMclquERFATWXuF7wjo7tQ3LsoH/GHqW80ZmUAvQZ6OMG6iGg== X-Received: by 10.194.198.165 with SMTP id jd5mr4239658wjc.171.1468663129552; Sat, 16 Jul 2016 02:58:49 -0700 (PDT) MIME-Version: 1.0 References: <001701d1daa2$30f7ac30$92e70490$@metastack.com> <1468179914.25014.89.camel@e130.lan.sumadev.de> <20160714090300.GB21053@frosties> <002601d1de7e$9f5776d0$de066470$@metastack.com> <20160715161308.GB30333@topoi.pooq.com> In-Reply-To: From: "vrotaru.md@gmail.com" Date: Sat, 16 Jul 2016 09:58:39 +0000 Message-ID: To: "Petter A. Urkedal" , Hendrik Boom Cc: caml users Content-Type: multipart/alternative; boundary=001a11360f9a21be200537bdc8fc Subject: Re: [Caml-list] Warnings opening modules (was: why is building ocaml hard?) --001a11360f9a21be200537bdc8fc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable About that missing type constructors problem. Seems doable: module A =3D struct module T =3D struct type t1 =3D ... type t2 =3D ... end include T let foo _ =3D ... let bar : t2 -> t1 =3D ... end module B =3D struct include A.T let foo, bar =3D A.( foo, bar ) end Obviously, not for already existing code. =C3=8En s=C3=A2m., 16 iul. 2016 la 10:41, Petter A. Urkedal a scris: > On 15 July 2016 at 18:13, Hendrik Boom wrote: > > And that's a real problem -- that fact that openning a module can fill > > the namespace with lots of stray identifiers, which the user does not > > control. > > Apart from the selective opens discussed, it would be good to tell > apart which modules are meant to be open and which are intrusive > without looking through them. Most importantly the writer of the > library should be clear about it from the start when designing a > module, then the names will be consistent with the choice, and users > should be able to decide without evaluating the whole interface. > > A warning when opening an invasive module in a global scope could > help, as well. One could maybe decide a module to be invasive from a > few heuristics with fall-back to a declaration: > > - A module interface defining a single-letter identifier, most > importantly a type "t" or a signature "S", is invasive. > - A module interface overriding any operator (or identifier?) defined > in Pervasives is invasive. > - A module interface declaring itself `[@@@ocaml.invasive]` is invasive. > > Conversely the user may silence the warning with `open M > [@@ocaml.invasive]`. > > -- > 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 > --001a11360f9a21be200537bdc8fc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

About that missing type constructors problem. See= ms doable:

module A =3D struct=
=C2=A0 module T =3D struct
=C2=A0=C2=A0=C2=A0 type t1 =3D ...
=C2= =A0=C2=A0=C2=A0 type t2 =3D ...
=C2=A0 end
=C2=A0 include T

= =C2=A0 let foo _ =3D ...
=C2=A0 let bar : t2 -> t1=C2=A0 =3D ...
e= nd

module B =3D struct

=C2=A0 include A.T
=C2=A0 let foo, = bar =3D A.( foo, bar )

end

Obviously, not for already = existing code.

=C3=8En s=C3= =A2m., 16 iul. 2016 la 10:41, Petter A. Urkedal <paurkedal@gmail.com> a scris:
On 15 July 2016 at 18:13, Hendrik Boom <hendrik@topoi.pooq.com>= ; wrote:
> And that's a real problem -- that fact that openning a module can = fill
> the namespace with lots of stray identifiers, which the user does not<= br> > control.

Apart from the selective opens discussed, it would be good to tell
apart which modules are meant to be open and which are intrusive
without looking through them.=C2=A0 Most importantly the writer of the
library should be clear about it from the start when designing a
module, then the names will be consistent with the choice, and users
should be able to decide without evaluating the whole interface.

A warning when opening an invasive module in a global scope could
help, as well.=C2=A0 One could maybe decide a module to be invasive from a<= br> few heuristics with fall-back to a declaration:

- A module interface defining a single-letter identifier, most
importantly a type "t" or a signature "S", is invasive.=
- A module interface overriding any operator (or identifier?) defined
in Pervasives is invasive.
- A module interface declaring itself `[@@@ocaml.invasive]` is invasive.

Conversely the user may silence the warning with `open M [@@ocaml.invasive]= `.

--
Caml-list mailing list.=C2=A0 Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocam= l_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
--001a11360f9a21be200537bdc8fc--