caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: John Max Skaller <skaller@ozemail.com.au>
To: Brian Rogoff <bpr@best.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] two unrelated questions
Date: Sat, 28 Apr 2001 03:49:12 +1000	[thread overview]
Message-ID: <3AE9B118.C9B4E2A7@ozemail.com.au> (raw)
In-Reply-To: <Pine.BSF.4.21.0104270739210.9762-100000@shell5.ba.best.com>

Brian Rogoff wrote:
> On Thu, 26 Apr 2001, John Max Skaller wrote:
> > Unfortunately:
> >
> >       let f x =
> >               exception Break
> >               try ... raise Break ...
> >               with Break -> ()
> >       ;;
> >
> > is in error, because exception declarations must be at the top
> > level. 

> Well, this kind of thing is what local does in SML and a few people have
> asked for it before. You can use the local module feature to do the
> same thing.
> 
> let f x =
>   let module Local = struct
>     exception Break
>     let f () =
>     try (print_endline ("hello " ^ x); raise Break) with Break -> ()
>   end in
>   Local.f ()

	Actually, this works too:

	let f x = 
		let module Local = struct exception Break end in
		try raise Local.Break with Local.Break -> ()

Furthermore, this doesn't work:

	let f x = 
		type integer = int
		let i:integer = 1 in ...

but this does:

	let f x = 
		let module Local = struct type integer = int end in
		let i: Local.integer = 1 in ...
		

which makes me wonder why it is necessary to wrap exception 
declarations and type aliases in modules: is there a semantic
reason I'm missing, or is it just a parsing issue?

-- 
John (Max) Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


  reply	other threads:[~2001-04-29 21:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-25 21:08 Chris Hecker
2001-04-26  0:38 ` Patrick M Doane
2001-04-26  6:04   ` Judicaël Courant
2001-04-26 12:06     ` John Max Skaller
2001-04-27  9:12       ` Anton Moscal
2001-04-29 22:24         ` Brian Rogoff
2001-04-30 18:57           ` Fergus Henderson
2001-05-01  1:31           ` Jacques Garrigue
2001-05-01 12:45             ` [Caml-list] " Ken Friis Larsen
2001-04-27 15:09       ` [Caml-list] " Brian Rogoff
2001-04-27 17:49         ` John Max Skaller [this message]
2001-04-26  8:22   ` Andreas Rossberg
2001-04-26  1:13 ` Jacques Garrigue
2001-04-26 13:47 ` Xavier Leroy
2001-04-26 22:34   ` Chris Hecker
2001-04-26 16:57 ` Mark Seaborn
2001-04-26 22:20   ` John Max Skaller
2001-05-01 21:08     ` Brian Rogoff
2001-05-01 23:30       ` John Max Skaller
2001-05-02  0:03       ` John Max Skaller
2001-05-01 17:25 Dave Berry

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=3AE9B118.C9B4E2A7@ozemail.com.au \
    --to=skaller@ozemail.com.au \
    --cc=bpr@best.com \
    --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;
as well as URLs for NNTP newsgroup(s).