Re: another approach to sprintf (Re: ocaml 2.02 bug: curried printf)

From: Xavier Leroy (Xavier.Leroy@inria.fr)
Date: Tue Mar 23 1999 - 17:17:53 MET


Date: Tue, 23 Mar 1999 17:17:53 +0100
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Eijiro Sumii <sumii@venus.is.s.u-tokyo.ac.jp>, caml-list@inria.fr
Subject: Re: another approach to sprintf (Re: ocaml 2.02 bug: curried printf)
In-Reply-To: <19990319174720-10695P.sumii@harp.is.s.u-tokyo.ac.jp>; from Eijiro Sumii on Fri, Mar 19, 1999 at 05:47:20PM +0900

> I don't know very much about *printf in ocaml, but how about Olivier
> Danvy's approach to sprintf (http://www.brics.dk/RS/98/12/index.html)?
> It seems safer and faster than ordinary "interpretive" approach. I'd
> like to hear what do you (I mean, readers of this mailing list) think
> about it.

It's a cute trick. One drawback is that the format is not a character
string, but needs to be expressed using special functions and infix
operators. On the other hand, it doesn't need the special
typechecking rules for format strings that we have in OCaml.

With this special typechecking rules, I don't think Danvy's "partially
evaluated" printf is any safer than OCaml's "interpreted" printf.

Also, it doesn't solve (nor makes any worse) the issues with partial
application of printf and friends that we discussed before.

- Xavier Leroy



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:21 MET