English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Compiler feature - useful or not?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-11-16 (18:10)
From: Fernando Alegre <fernando@g...>
Subject: Re: [Caml-list] Compiler feature - useful or not?
On Fri, Nov 16, 2007 at 11:54:30AM -0600, Edgar Friendly wrote:
> > 
> Explicit casts, my friend.  Explicit casts to convert from int to

Yes. I think explicit casts should be extended to some of these cases.

> permission and back.  And automatically generated runtime checks to
> ensure that you don't try to convert ( 37 :> permission ).  1 remains an

No, no. Run-time checks are evil :-) I mean, OCaml is supposed to be
a static type-safe system, so that programs that typecheck are guaranteed to
run (maybe forever...) and never segfault. While exceptions are needed
for I/O, no core expression should raise an exception.

I think explicit casts of compile-time constants is safe (sound?), and explicit
casts of a general (int :> finite type) are unsafe. I don't know whether there
is a middle ground that can be both safe and useful. I guess some of
the researchers on this list must know the answer (or know there is no
answer, or whatever...)