Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Again on 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: Alessandro Baretta <alex@b...>
Subject: Re: [Caml-list] Again on pattern matching and strings


Jacques Garrigue wrote:

> That message was about polymorphic variants, which are encoded as
> integers, and for which pattern-matching is a decision tree.
> 
> However, if you look in bytecomp/matching.ml, you will see that string
> patterns are just checked sequentially (the ordering is not used).
> Moreover, the match compiler seems to be clever enough to compile
> properly the above style:...

Very strange. I thought the Ocaml compiler sould 
precalculate the branch of pattern matching to be taken, and 
then jump, thereby avoiding sequential checking. I'm sorry 
for my mistake.

Alex Baretta

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