From: Anton Moscal <msk@post.tepkom.ru>
To: caml-list@inria.fr
Subject: Local definitions
Date: Mon, 5 Oct 1998 18:27:18 +0400 (MSD) [thread overview]
Message-ID: <Pine.LNX.4.03.9810051823001.28401-100000@post.tepkom.ru> (raw)
In-Reply-To: <199809280951.LAA27562@pauillac.inria.fr>
Hello!
Why CaML doesn't not allow the following style of local definitions:
declare
<definition> ...
in
<expression>
with following translation:
let module Temp = struct
<definition>...
let result = <expression>
end in
Temp.result
or, the second variant: simply allow declaration of
types, exceptions, open statements and others in "let-in"
expressions with the same translation:
let find x vec =
let exception Return of int in
try
Array.iteri (fun i elem -> if elem = x then raise (Return i)) vec;
None
with
Return i -> Some i
can be translated as:
let find x vec =
let module T = struct
exception Return of int
let res =
try
Array.iteri (fun i elem -> if elem = x then raise (Return i)) vec;
None
with
Return i -> Some i
end in T.res
This syntax allow more convenient notation for local types,
classes, exceptions and others definitions, than explicit usage of
local modules.
Anton E. Moscal msk@vvv.niimm.spb.ru
next prev parent reply other threads:[~1998-10-05 15:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-09-21 16:30 polymorphic recursion Peter J Thiemann
1998-09-22 2:33 ` Jacques GARRIGUE
1998-09-22 9:22 ` Pierre Weis
1998-09-22 10:00 ` Simon Helsen
1998-09-22 15:06 ` Pierre Weis
1998-09-22 15:28 ` Simon Helsen
1998-09-22 16:33 ` Pierre Weis
1998-09-22 15:50 ` Pierre CREGUT - FT.BD/CNET/DTL/MSV
1998-09-22 17:14 ` Xavier Leroy
1998-09-28 9:51 ` Pierre Weis
1998-09-28 11:45 ` Peter Thiemann
1998-09-28 13:00 ` Pierre Weis
1998-10-05 14:27 ` Anton Moscal [this message]
1998-10-12 11:39 ` Local definitions Xavier Leroy
1998-10-12 17:20 ` Adam P. Jenkins
1998-10-14 13:47 ` Anton Moscal
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=Pine.LNX.4.03.9810051823001.28401-100000@post.tepkom.ru \
--to=msk@post.tepkom.ru \
--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