From: Alessandro Baretta <alex@baretta.com>
To: Ocaml <caml-list@inria.fr>
Subject: Re: [Caml-list] Pattern matching and strings (and a mini-bug in Scanf)
Date: Fri, 04 Oct 2002 21:31:07 +0200 [thread overview]
Message-ID: <3D9DEC7B.9080708@baretta.com> (raw)
In-Reply-To: <87fzvmieu9.dlv@wanadoo.fr>
Remi VANICAT wrote:
> Alessandro Baretta <alex@baretta.com> 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 = <fun>
>
> 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
next prev parent reply other threads:[~2002-10-04 19:21 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-02 14:12 [Caml-list] Pattern matching and strings Alessandro Baretta
2002-10-02 15:02 ` Luc Maranget
2002-10-02 16:21 ` [Caml-list] Pattern matching and strings (and a mini-bug in Scanf) Alessandro Baretta
2002-10-02 17:15 ` Luc Maranget
2002-10-02 18:30 ` Alessandro Baretta
2002-10-02 18:32 ` Benjamin C. Pierce
2002-10-04 13:01 ` Florian Douetteau
2002-10-04 9:07 ` Pierre Weis
2002-10-04 9:31 ` Alessandro Baretta
2002-10-04 10:03 ` Pierre Weis
2002-10-04 10:23 ` Alessandro Baretta
2002-10-04 12:11 ` Remi VANICAT
2002-10-04 12:40 ` [Caml-list] Ocaml 3.06 Win2K OCAML/C link problem Ward Wheeler
2002-10-04 13:12 ` [Caml-list] Pattern matching and strings (and a mini-bug inScanf) Frederic van der Plancke
2002-10-04 19:31 ` Alessandro Baretta [this message]
2002-10-07 7:17 ` [Caml-list] Pattern matching and strings (and a mini-bug in Scanf) Pierre Weis
2002-10-02 20:59 ` [Caml-list] views for strings (was: Pattern matching and strings) Chris Hecker
2002-10-02 23:09 ` [Caml-list] " Alessandro Baretta
2002-10-03 8:31 ` [Caml-list] Pattern matching and strings Sven Luther
2002-10-04 12:00 ` Andreas Rossberg
2002-10-04 14:21 ` Kontra, Gergely
2002-10-04 15:14 ` Luc Maranget
2002-10-04 19:38 ` Alessandro Baretta
2002-10-05 6:34 ` [Caml-list] Camlp4 (Was: Pattern matching and strings) Daniel de Rauglaudre
2002-10-05 12:47 ` Sven LUTHER
2002-10-05 12:42 ` Daniel de Rauglaudre
2002-10-05 13:41 ` Michel Mauny
2002-10-05 13:47 ` Daniel de Rauglaudre
2002-10-05 14:09 ` Michel Mauny
2002-10-05 18:13 ` Alessandro Baretta
2002-10-05 20:30 ` [Caml-list] Future of Camlp4 Daniel de Rauglaudre
2002-10-04 19:13 ` [Caml-list] Pattern matching and strings Sven LUTHER
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3D9DEC7B.9080708@baretta.com \
--to=alex@baretta.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox