From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA07277 for caml-red; Tue, 22 Aug 2000 10:34:51 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA11504 for ; Tue, 22 Aug 2000 10:31:33 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.10.0/8.10.0) with ESMTP id e7M8VST06038; Tue, 22 Aug 2000 10:31:28 +0200 (MET DST) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA10895; Tue, 22 Aug 2000 10:31:27 +0200 (MET DST) From: Pierre Weis Message-Id: <200008220831.KAA10895@pauillac.inria.fr> Subject: Re: Question on language design (keywords vs Pervasives) In-Reply-To: <200008220038.JAA10162@ropas.kaist.ac.kr> from Kwangkeun Yi at "Aug 22, 100 09:38:05 am" To: kwang@ropas.kaist.ac.kr (Kwangkeun Yi) Date: Tue, 22 Aug 2000 10:31:27 +0200 (MET DST) Cc: caml-list@inria.fr X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: weis@pauillac.inria.fr > > I'm sure that there is no ``more primitive function'' than raise to > > raise an exception. So sorry, you cannot define raise ``in terms of a > > more primitive function'' in Caml. You would need a language with > > call/cc to express that, and Caml is not this language. > > To make it precise, we don't even need call/cc. > Just a kind of cps transformation that carries two continuations (one > for normal continuation and the other for handler continuation) > removes all the raise/try expressions. The transformation is > well-known. See > > @InProceedings{KiYiDa98, > author = "Jung-taek Kim and Kwangkeun Yi and Olivier Danvy", > title = "Assessing the Overhead of ML Exceptions by Selective > CPS Transformation", > pages = "103-114", > booktitle = "The Proceedings of the ACM SIGPLAN Workshop on ML", > year = 1998, > url = "http://ropas.kaist.ac.kr/~kwang/paper/98-ml-kiyida.ps.gz", > month = sep > } > > -Kwang > > -- > Kwangkeun Yi http://cs.kaist.ac.kr/~kwang The problem was not to remove try/raise expressions from programs, but to define raise in terms of ``more primitive functions''. I'm not sure a cps transformation can be considered as ``a primitive function'' of the language that can help to define raise into the language. I'm sure you can use a lot of other transformations to remove try/raise, e.g. a monadic transformation or a direct expression of the semantics of exceptions (using a direct sum of normal and exceptional results) could also do the job. Pierre Weis INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://cristal.inria.fr/~weis/