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: Frederic van der Plancke <fvdp@d...>
Subject: Re: [Caml-list] Pattern matching and strings (and a mini-bug inScanf)


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.

But if %z returns a string like %s, does it need an additional case in OCaml's
global *type*checker* ? Shouldn't it suffice to modify the function in the scanf
implementation that determines the type of a format ?

Frédéric vdP

-------------------
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