Version franēaise
Home     About     Download     Resources     Contact us    
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: -- (:)
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...)

Thanks,
Fernando