From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA04944 for caml-red; Wed, 8 Nov 2000 19:53:52 +0100 (MET) 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 SAA28829 for ; Wed, 8 Nov 2000 18:56:17 +0100 (MET) Received: from mta5.snfc21.pbi.net (mta5.snfc21.pbi.net [206.13.28.241]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id eA8HuF912586; Wed, 8 Nov 2000 18:56:16 +0100 (MET) Received: from checkerlap.d6.com ([64.160.53.49]) by mta5.snfc21.pbi.net (Sun Internet Mail Server sims.3.5.2000.01.05.12.18.p9) with ESMTP id <0G3P00JYKUP0R6@mta5.snfc21.pbi.net>; Wed, 8 Nov 2000 09:17:25 -0800 (PST) Date: Wed, 08 Nov 2000 09:20:18 -0800 From: Chris Hecker Subject: Re: fixed length arrays as types In-reply-to: <20001108105312.57768@pauillac.inria.fr> X-Sender: def6@shell16.ba.best.com To: Xavier Leroy , caml-list@inria.fr Message-id: <4.3.2.7.2.20001108090802.00bb9570@shell16.ba.best.com> MIME-version: 1.0 X-Mailer: QUALCOMM Windows Eudora Version 4.3.2 Content-type: text/plain; charset="us-ascii" References: <4.3.2.7.2.20001104165041.00b3e370@shell16.ba.best.com> <4.3.2.7.2.20001104165041.00b3e370@shell16.ba.best.com> Sender: weis@pauillac.inria.fr >To me, having array sizes in the array types is mostly a left-over >from languages where the compiler needs to treat static or >stack-allocated arrays differently than dynamically-allocated arrays. >My feeling is that when all arrays are dynamically allocated, it's >more natural and a whole lot simpler to never reflect array sizes in >array types. I disagree about this. It's really about type safety and strong typing. You can catch a lot of errors if you can type the shape of the array (especially in numerical code). Not only can you get rid of assert(size(array)==4) in every numerical function, but you can also safely get rid of runtime bounds checks in some cases (as Xi's work shows). But, ignoring efficiency, I think the added type safety is a win. >As a case in point, the evolution from C++ to Java >follows this path. I think it's clear Java is a step backwards relative to C++ in the realm of typesafety. I don't mean to start a flame war, however. I'm no fan of C++ either these days. Chris