From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA09034; Fri, 4 Oct 2002 21:21:08 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA09224 for ; Fri, 4 Oct 2002 21:21:07 +0200 (MET DST) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from athlon.baretta.com (r-mi214-6a66.tin.it [62.211.4.66]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g94JL5507169 for ; Fri, 4 Oct 2002 21:21:06 +0200 (MET DST) Received: from baretta.com (localhost.localdomain [127.0.0.1]) by athlon.baretta.com (Postfix) with ESMTP id E46D627246 for ; Fri, 4 Oct 2002 21:31:07 +0200 (CEST) Message-ID: <3D9DEC7B.9080708@baretta.com> Date: Fri, 04 Oct 2002 21:31:07 +0200 From: Alessandro Baretta Organization: Baretta srl -- www.baretta.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: it, en MIME-Version: 1.0 To: Ocaml Subject: Re: [Caml-list] Pattern matching and strings (and a mini-bug in Scanf) References: <200210041003.MAA19581@pauillac.inria.fr> <3D9D6C28.8060903@baretta.com> <87fzvmieu9.dlv@wanadoo.fr> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Remi VANICAT wrote: > Alessandro Baretta writes: > > >>Pierre Weis wrote: >> >>>[...] >> >>>I should say that I am reluctant to had a special typing rule for the >>>new specifier you proposed, when "%[\000-\255]" does perfectly the job >>>and does not require any addition to the type-checker nor to the >>>implementation of Scanf. >>>Pierre Weis >> >>Why do you mention the type checker? Is each conversion specifier a >>special case for the type checker? > > > Of course it is : > > # Scanf.scanf "%s %d %i";; > - : (string -> int -> int -> '_a) -> '_a = > > to type this, the type checker have to look inside the format and find > that %s look for a string, %d and %i an int. > I did not make myself clear. Of course, the type checker has to delve into a format string to figure out how to type Scanf.sscanf "%s %d %i", but that does not mean that "%s %[abc] %[^def]" requires three different "special cases" in the type checker. I haven't read how the typechecker reads format strings, but I would expect that it should only be intersted in the *type* of the conversion specifier, as opposed to how the conversion is implemented. All conversions specifying integers should be treated uniformly by the type checker; by the same standards all conversions specifying strings should be treated in the same way. A "%z" specifier meaning "everything till the end of input" should look no different to the type checker than a "%s" or a "%[abc]". Anyhow, I can live with "%[\000-\255]", but I still think that a "%z" would be a worthy addition. Alex ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners