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 JAA05448; Mon, 7 Oct 2002 09:17:57 +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 JAA05372 for ; Mon, 7 Oct 2002 09:17:56 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g977Ht513315; Mon, 7 Oct 2002 09:17:55 +0200 (MET DST) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA05359; Mon, 7 Oct 2002 09:17:54 +0200 (MET DST) From: Pierre Weis Message-Id: <200210070717.JAA05359@pauillac.inria.fr> Subject: Re: [Caml-list] Pattern matching and strings (and a mini-bug in Scanf) In-Reply-To: <3D9DEC7B.9080708@baretta.com> from Alessandro Baretta at "Oct 4, 102 09:31:07 pm" To: alex@baretta.com (Alessandro Baretta) Date: Mon, 7 Oct 2002 09:17:54 +0200 (MET DST) Cc: caml-list@inria.fr X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk [...] > 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. You're right it only needs two special cases: %s and %[...] > 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. Absolutely. > A "%z" specifier meaning "everything till the end of input" should > look no different to the type checker than a "%s" or a "%[abc]". Evidently, but the type-checker needs a special case to match %z anyhow. Also remember that the type-checker is typing format, hence those typing are used both for printing and scaning. It means we have to be careful to have both interpretations to each convertion. So what would be the meaning of Printf.printf "%z" ? > Anyhow, I can live with "%[\000-\255]", but I still think > that a "%z" would be a worthy addition. > > Alex Thank you for living with "%[\000-\255]". Best regards, Pierre Weis INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/ ------------------- 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