From: Goswin von Brederlow <goswin-v-b@web.de>
To: caml-list@inria.fr
Subject: Re: [Caml-list] destructive local opens
Date: Fri, 14 Aug 2015 12:55:51 +0200 [thread overview]
Message-ID: <20150814105551.GD31364@frosties> (raw)
In-Reply-To: <CALdWJ+zsKtXnE9zbVTSyuRV8+jwRVP9Ahp202ncOYj7JUHcKpQ@mail.gmail.com>
On Tue, Aug 04, 2015 at 09:14:49AM -0400, Ivan Gotovchits wrote:
> 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 |])
You can't qualifylocal values or values of the surrounding module so
that is a no go.
I also often use local open to access records, as in:
let r = M.({ x = 1; y; z = depth; }) in
So I can't agree that M.() should only access values from M. Far from it.
> 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 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
> >
> >
> > În Mar, 4 aug. 2015 la 12:40, Daniel Bünzli <daniel.buenzli@erratique.ch>
> > a scris:
> >
> >> Le mardi, 4 août 2015 à 10:26, Goswin von Brederlow a écrit :
> >> > > let ox = 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
MfG
Goswin
next prev parent reply other threads:[~2015-08-14 10:56 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-03 13:39 Nils Becker
2015-08-03 13:43 ` Thomas Refis
2015-08-03 13:45 ` Daniel Bünzli
2015-08-03 13:47 ` Daniel Bünzli
[not found] ` <55BF75F6.1040006@bioquant.uni-heidelberg.de>
2015-08-03 14:24 ` Daniel Bünzli
2015-08-03 14:37 ` Gabriel Scherer
2015-08-03 14:43 ` Daniel Bünzli
2015-08-03 15:10 ` octachron
2015-08-03 15:22 ` Daniel Bünzli
2015-08-03 16:13 ` octachron
2015-08-03 16:51 ` Daniel Bünzli
2015-08-03 17:18 ` Hendrik Boom
2015-08-03 17:59 ` octachron
2015-08-06 13:23 ` RE : " moreno pedro
2015-08-04 6:51 ` Petter Urkedal
2015-08-04 9:33 ` Goswin von Brederlow
2015-08-05 6:40 ` Petter A. Urkedal
2015-08-05 10:16 ` David Allsopp
2015-08-06 9:35 ` Goswin von Brederlow
2015-08-04 13:50 ` Hendrik Boom
2015-08-04 9:26 ` Goswin von Brederlow
2015-08-04 9:38 ` Daniel Bünzli
2015-08-04 12:26 ` vrotaru.md
2015-08-04 13:12 ` David Allsopp
2015-08-04 13:17 ` Jeremy Yallop
2015-08-04 13:54 ` vrotaru.md
2015-08-04 15:25 ` Drup
2015-08-04 22:22 ` vrotaru.md
2015-08-04 22:55 ` Hendrik Boom
2015-08-05 4:52 ` Gabriel Scherer
2015-08-04 13:14 ` Ivan Gotovchits
2015-08-14 10:55 ` Goswin von Brederlow [this message]
2015-08-14 11:28 ` Drup
2015-08-18 11:11 ` Goswin von Brederlow
2015-08-18 12:52 ` David Allsopp
2015-08-18 13:00 ` Gabriel Scherer
2015-08-18 22:26 ` Anthony Tavener
2015-08-19 13:55 ` Oleg
2015-08-19 14:13 ` John Whitington
2015-08-19 15:47 ` Hendrik Boom
2015-08-19 15:52 ` Hendrik Boom
2015-08-19 18:09 ` Anthony Tavener
2015-08-19 15:55 ` Simon Cruanes
2015-08-19 16:42 ` Arthur Wendling
2015-08-19 21:15 ` octachron
2015-08-20 8:06 ` Romain Bardou
2015-08-20 17:03 ` Yotam Barnoy
2015-08-20 19:19 ` Erkki Seppala
2015-08-06 9:23 ` Goswin von Brederlow
2015-08-06 9:21 ` Goswin von Brederlow
2015-08-06 10:19 ` Daniel Bünzli
2015-08-06 13:36 ` Hendrik Boom
2015-08-14 10:57 ` Goswin von Brederlow
2015-08-17 10:17 Nils Becker
2015-08-17 14:26 ` Gabriel Scherer
2015-08-17 15:11 ` Nils Becker
2015-08-17 15:17 ` Drup
2015-08-17 15:18 ` Gabriel Scherer
2015-08-17 18:31 ` Hendrik Boom
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=20150814105551.GD31364@frosties \
--to=goswin-v-b@web.de \
--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