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 GAA09238; Thu, 4 Oct 2001 06:29:50 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id GAA09239 for ; Thu, 4 Oct 2001 06:29:49 +0200 (MET DST) Received: from exchange.cs.cornell.edu (exchange.cs.cornell.edu [128.84.97.8]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f944TmP17818; Thu, 4 Oct 2001 06:29:48 +0200 (MET DST) X-MimeOLE: Produced By Microsoft Exchange V6.0.4712.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: [Caml-list] Pattern matcher no more supposed to warn on non exhaustive patterns ? Date: Thu, 4 Oct 2001 00:29:47 -0400 Message-ID: <706871B20764CD449DB0E8E3D81C4D4301EE6C00@opus.cs.cornell.edu> Thread-Topic: [Caml-list] Pattern matcher no more supposed to warn on non exhaustive patterns ? Thread-Index: AcFMTcrWmyUi6r9ZS0+5yqXqzDAnTwAPdn/A From: "Gregory Morrisett" To: "Pierre Weis" , "Daniel Grossman" Cc: Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk The issue with threads is a bit more troublesome. Consider: let x : (int->int) option ref =3D ref (Some (fun x -> x));; let foo z =3D match z with {contents=3DNone} -> 0 | {contents=3DSome(f)} -> f(0); Now suppose I fork two threads: Thread 1: foo x Thread 2: x :=3D None And suppose that Thread 1 runs long enough that it does the first match, so it assumes the contents of x is not of the form None. =20 Now Thread 1 gets descheduled, Thread 2 runs, and sets the contents of x to None. Then Thread 2 continues with the second match... The question is, does Caml core dump because the pattern matcher assumes that the contents *has* to be a Some(-) in the second case? Or does it do the derefence and check atomically? Or does it add a default case that raises a Match exception? =20 The same thing shows up in SML/NJ with CML. The problem is that in the presence of threads, you really shouldn't be able to=20 dereference a mutable value in your patterns. -Greg ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr