Version française
Home     About     Download     Resources     Contact us    
Browse thread
Search for the smallest possible possible Ocaml segfault....
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: pierre.weis@i...
Subject: Re: [Caml-list] OCaml's formatting libraries
[...]
> A question I have is why caml's formatting libraries were not  
> deprecated in favor of an implementation using Danvy's functional  
> unparsing [1]. This approach doesn't require an extension to the type  
> system and if I read correctly these results [2] it seems at least as  
> efficient as the current implementation. Scanf seems also doable [3].

If this functional unparsing can be rendered fully backward compatible with
the existing printf and scanf related Caml users' code base, then we can give
it a try. Otherwise, we would have to maintain two libraries in parallel...

> The less complexity there is in the type system the safer we are in  
> the end.

The type system is not modified. We just have to add a new basic
(polymorphic) type constant to the set of basic types; and the corresponding
constant values are then type checked using the plain old polymorphic type
algebra.

The problem we have with the dynamic format strings compatibility check is
similar to any other bug into any other basic Caml primitive: a bug in those
primitives can be fatal to the type safety. (The bug in the compatibility
check has similar consequences as would a bug in the implementation of the
int_of_string primitive, if int_of_string were erroneously returning a float
value in some rare cases, while still keeping the regular string -> int type
scheme.)

All the best,

-- 
Pierre Weis

INRIA Rocquencourt, http://bat8.inria.fr/~weis/