Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: [Caml-list] Pattern matching and strings
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pierre Weis <pierre.weis@i...>
Subject: Re: [Caml-list] Pattern matching and strings (and a mini-bug in Scanf)
[...]
> 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