Version française
Home     About     Download     Resources     Contact us    
Browse thread
Question on language design (keywords vs Pervasives)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pierre Weis <Pierre.Weis@i...>
Subject: Re: Question on language design (keywords vs Pervasives)
> > 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/