Re: Break

From: Pierre Weis (weis@pauillac.inria.fr)
Date: Tue Feb 25 1997 - 13:34:39 MET


From: Pierre Weis <weis@pauillac.inria.fr>
Message-Id: <199702251234.NAA09052@pauillac.inria.fr>
Subject: Re: Break
In-Reply-To: <199702242000.MAA28634@vegemite.Stanford.EDU> from Andrew Conway at "Feb 24, 97 12:00:53 pm"
To: arc@sequence.Stanford.EDU (Andrew Conway)
Date: Tue, 25 Feb 1997 13:34:39 +0100 (MET)

> I would like to suggest a "new" standard exception: Pervasives.Break.

There already exists a Break exception:

# Sys.Break;;
- : exn = Break

It has another meaning, snce it is used to signal an interrupt (^C in
general under Unix).

# raise Sys.Break;;
Interrupted.

Ther is no problem to use it to exit from loops, but it could be a bit
confusing. Thus, there also exists an exception devoted to premature
exits from loops:

# Pervasives.Exit;;
- : exn = Exit

you should raise the Exit exception when you want a premature end of
loop. (This is also true for Caml Light.)

> [ En mauvais francais ]
>
> Chers Utilisateurs de Caml,
>
> Je voudrais vous proposer un exception nouveau : Pervasives.break.

Elle existe de'ja`: c'est l'exception Pervasives.Exit en Objective
Caml ou Exit en Caml Light. L'exception Sys.Break (ou sys__Break) est
consacre'e a` signaler les interruption venant du syste`me
d'exploitation (en ge'ne'ral appui sur ^C sous Unix).

Best regards,

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:09 MET