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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 858E57EEBF for ; Tue, 4 Aug 2015 15:14:51 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of ivg@ieee.org) identity=pra; client-ip=209.85.217.175; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="ivg@ieee.org"; x-sender="ivg@ieee.org"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of ivg@ieee.org designates 209.85.217.175 as permitted sender) identity=mailfrom; client-ip=209.85.217.175; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="ivg@ieee.org"; x-sender="ivg@ieee.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-lb0-f175.google.com) identity=helo; client-ip=209.85.217.175; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="ivg@ieee.org"; x-sender="postmaster@mail-lb0-f175.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AQAgB8ucBVm6/ZVdFbgn1xaQaDHaYiBoMfj1GCN4V5AoEqB0wBAQEBAQESAQEBAQEGCwsJISMLhCQBAQMBEhEERwsFCwsEBxodAgIhARIBBQEKEgYTEhCHdwMKCA2mV4EuPjGLP5B6AwqFNwEBAQEBBQEBAQEBARwKhhWFMIJPgjUEB4JpgUMFhWYMjwmEfYVogWuCDZAYhWQSI4EXEQaEKCIxgkwBAQE X-IPAS-Result: A0AQAgB8ucBVm6/ZVdFbgn1xaQaDHaYiBoMfj1GCN4V5AoEqB0wBAQEBAQESAQEBAQEGCwsJISMLhCQBAQMBEhEERwsFCwsEBxodAgIhARIBBQEKEgYTEhCHdwMKCA2mV4EuPjGLP5B6AwqFNwEBAQEBBQEBAQEBARwKhhWFMIJPgjUEB4JpgUMFhWYMjwmEfYVogWuCDZAYhWQSI4EXEQaEKCIxgkwBAQE X-IronPort-AV: E=Sophos;i="5.15,608,1432591200"; d="scan'208";a="172632924" Received: from mail-lb0-f175.google.com ([209.85.217.175]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 04 Aug 2015 15:14:50 +0200 Received: by lbbyj8 with SMTP id yj8so5733033lbb.0 for ; Tue, 04 Aug 2015 06:14:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=igpFaabmZgDx1Q/YkemS6B68o/Qu1POoQrpy4lCz5Rg=; b=jUR+8Y9WSWVYk1qeC1QGpAcCPQAQ2CPaZ8wYVr5g2mqE4igr9FipNuppZOD0qdENxg 8x41V211PT3RVad0ISjcRc3Q3Mr/UPyw+R4A2IUVVss1kJpEgMr8mxe9nWX3fKScb92I 3qnpycR48FNq7WzqGS17pTMO1+SLf5g5nK4pBERQTDcYyaf2zlh3gFDyYyQAjlC3r6e1 Az4BVYdISIOFBiWlgHVn9BEi0qTwrKMOaabzksKhliTXKYROOUbNoq/05oe6YkAIIk4Y BLDTxD/cRBMRtMIsCFMQtIsteLt8Et9n6Gr562A3jTxdtsVMq61I4LPFct+yXlsS1vXn a8DA== X-Gm-Message-State: ALoCoQmeViBJNiKK5Qb+m9pD6NQyFt1c89P8QrNpdPsQCJkyCzk8spgIgBm+rfToKI+Tok0F7IwD MIME-Version: 1.0 X-Received: by 10.152.120.135 with SMTP id lc7mr3338412lab.41.1438694089881; Tue, 04 Aug 2015 06:14:49 -0700 (PDT) Received: by 10.114.26.99 with HTTP; Tue, 4 Aug 2015 06:14:49 -0700 (PDT) In-Reply-To: References: <55BF6F1C.3050705@bioquant.uni-heidelberg.de> <55BF75F6.1040006@bioquant.uni-heidelberg.de> <8E1A640CE3374EB492981ADB0A2DA5C6@erratique.ch> <20150804092633.GC5689@frosties> <5C2023F4AF0549F58F3E4C9A6F8ABE84@erratique.ch> Date: Tue, 4 Aug 2015 09:14:49 -0400 Message-ID: From: Ivan Gotovchits To: "vrotaru.md@gmail.com" Cc: =?UTF-8?Q?Daniel_B=C3=BCnzli?= , Goswin von Brederlow , caml-list Content-Type: multipart/alternative; boundary=089e012281ac2b109c051c7c12e3 Subject: Re: [Caml-list] destructive local opens --089e012281ac2b109c051c7c12e3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I would prefer if the compiler warns us if in expression `M.(x)` the value `x` is not in the scope of `M`. Clarification: usually when we say `M.(x + cross y)` we want to use only values from module `M` and problems arise when something is captured from outside the module. Such kind of local opens are usually use to open rich modules, that fully defines an algebra of a type, i.e., a full suite of common operations like, comparison operations, arithmetics, etc. So, using local open is some kind of local algebra switch operation. In other words switching to other domain specific language. A good style would be to explicitly qualify every external value that is used inside the local opened scope: M.(x * Vec.of_array [| 1; 2 |]) On Tue, Aug 4, 2015 at 8:26 AM, vrotaru.md@gmail.com wrote: > After reading this thread, I'm starting to thinking about another option, > namely: "local un-open", because I certainly dislike ambiguity. > > So, maybe, something like: > > Vec.( ^(3 * v) * vx + vy) > > where anything in ^(... ) is not subject local open. > > Regards > > > =C3=8En Mar, 4 aug. 2015 la 12:40, Daniel B=C3=BCnzli > a scris: > >> Le mardi, 4 ao=C3=BBt 2015 =C3=A0 10:26, Goswin von Brederlow a =C3=A9cr= it : >> > > let ox =3D V2.((dot v ox) * ox) in >> > > V2.(3 * ox + oy) >> > >> > What is wrong with that code? >> > >> > I'm assuming V2 has: >> > >> > val (+): t -> t -> t >> > val (*): int -> t -> t >> > val dot: t -> t -> int >> >> It also has >> >> val ox : t >> >> Daniel >> >> >> >> -- >> 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 > > --089e012281ac2b109c051c7c12e3 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I would prefer if the compiler warns us if in expression `= M.(x)` the value `x` is not in the scope of `M`.

Clarifi= cation: usually when we say `M.(x + cross y)` we want to use only values fr= om module `M`
and problems arise when something is captured from = outside the module. Such kind of local opens
are usually use to o= pen rich modules, that fully defines an algebra of a type, i.e., a full sui= te of=C2=A0
common operations like, comparison operations, arithm= etics, etc. So, using local open is some kind
of local algebra sw= itch operation. In other words switching to other domain specific language.=

A good style would be to explicitly qualify every= external value that is used inside the local opened scope:

<= /div>
M.(x * Vec.of_array [| 1; 2 |])


On Tue, Aug 4, 2015 at 8= :26 AM, vrotaru.md@gmail.com <vrotaru.md@gmail.com> wrote:
After reading this thread, I'm starting to thinki= ng about another option, namely: "local un-open", because I certa= inly dislike ambiguity.

So, maybe, something like:
=

Vec.( ^(3 *=C2=A0v) * vx + vy)

w= here anything in ^(... ) is not subject local open.

Regards


=C3=8En Mar, 4 aug.= 2015 la 12:40, Daniel B=C3=BCnzli <daniel.buenzli@erratique.ch> a scris:
Le mardi, 4 ao=C3=BBt 2015 =C3=A0 10= :26, Goswin von Brederlow a =C3=A9crit :
> > let ox =3D V2.((dot v ox) * ox) in
> > V2.(3 * ox + oy)
>
> What is wrong with that code?
>
> I'm assuming V2 has:
>
> val (+): t -> t -> t
> val (*): int -> t -> t
> val dot: t -> t -> int

It also has

val ox : t

Daniel



--
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

--089e012281ac2b109c051c7c12e3--