From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id CCEDCBC0A for ; Mon, 18 Dec 2006 04:18:11 +0100 (CET) Received: from ipmail02.adl2.internode.on.net (ipmail02.adl2.internode.on.net [203.16.214.141]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id kBI3I9es002155 for ; Mon, 18 Dec 2006 04:18:10 +0100 Received: from ppp14-213.lns2.syd7.internode.on.net (HELO rosella) ([59.167.14.213]) by ipmail02.adl2.internode.on.net with ESMTP; 18 Dec 2006 13:48:06 +1030 X-IronPort-AV: i="4.12,181,1165152600"; d="scan'208"; a="61711431:sNHT114389849" Subject: Re: [Caml-list] A Few Questions From: skaller To: Jonathan T Bryant Cc: caml-list@yquem.inria.fr In-Reply-To: <6471679.1166406715475.JavaMail.jtbryant@valdosta.edu> References: <6471679.1166406715475.JavaMail.jtbryant@valdosta.edu> Content-Type: text/plain Date: Mon, 18 Dec 2006 14:18:02 +1100 Message-Id: <1166411882.8881.42.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 45860871.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; threads:01 threads:01 gced:01 ocaml's:01 ocaml:01 posix:01 inference:01 arrays:01 'n':01 arrays:01 ocaml:01 oleg:01 sourceforge:01 polymorphic:01 wrote:01 On Sun, 2006-12-17 at 20:51 -0500, Jonathan T Bryant wrote: > 3) Since CML's threads are implemented via continuations, speculative > computation is allowed because > threads are simply GCed once they are not referenced any more. Since > OCaml's threads are implemeted > via system calls, is this still the case or do threads need to be > manually joined? I've run into > some instances where I can't create any more threads because the > "Thread limit" of 1024 has been > reached, but in code where nowhere near that many threads should be > left active. Is this limit an > OCaml limit or a system limit? system limit. > Also, what about threads that are > not referenced anymore but > should still be running (i.e., "background services" and the like)? Is > there any way to keep the GC > from collecting them? The gc doesn't collect threads in the first place. It may collect a data structure identifying the thread if it is unreachable. Under Posix, if a thread is joinable it will not die until joined. If it is detached, it will not die until it choses to. (Assuming you don't kill it). > 5) One possible extension is a vector type. Is it possible as is to > make the type inference > engine "as is" include the size of the underlying array as part of the > type information or does that > require modifications to the type system? You would not want to do this. Use tuples instead. Felix has arrays with known length as a data type, in fact they're precisely tuples. The length type is an anonymous sum of n units, written just 'n'. However full manipulation is not possible. For example you cannot have concat: array[t,n] * array[t,m] -> array[t,add(n,m)] because add(n,m) cannot work with an unconstrained type variable. In Felix, whilst (x:array[t,20]) + (y:array[t,30]) works correctly, you cannot concatenate arrays inside a routine with polymorphic array bounds, even if the instantiator would fix the bounds to a constant later. In Ocaml there's no instantiator in the first place, so the calculation would have to be done at run time anyhow and require dependent typing support. But the existing Array types in Ocaml simply drop the length information. This avoids the problem at the cost of not permitting enforced array bounds checks based on type. Note that in theory a subscript to an array of length n is a value of type n, which is a unit sum, so the subscript is a value of that unit sum, and such an index never requires any bounds checking. oleg showed a cute way to do the dependent typing on existing arrays, and avoid many unnecessary checks, in existing Ocaml. Maybe he can post the URL to that again. -- John Skaller Felix, successor to C++: http://felix.sf.net