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 KAA27665; Fri, 18 Oct 2002 10:23:29 +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 KAA27450 for ; Fri, 18 Oct 2002 10:23:28 +0200 (MET DST) Received: from mel-rto3.wanadoo.fr (smtp-out-3.wanadoo.fr [193.252.19.233]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g9I8NRD02411 for ; Fri, 18 Oct 2002 10:23:27 +0200 (MET DST) Received: from mel-rta8.wanadoo.fr (193.252.19.79) by mel-rto3.wanadoo.fr (6.5.007) id 3DA24D18006AD727 for caml-list@inria.fr; Fri, 18 Oct 2002 10:23:27 +0200 Received: from debian (80.8.83.115) by mel-rta8.wanadoo.fr (6.5.007) id 3DA24B4A0067D420 for caml-list@inria.fr; Fri, 18 Oct 2002 10:23:27 +0200 Received: from moi by debian with local (Exim 3.36 #1 (Debian)) id 182SPs-0000VU-00 for ; Fri, 18 Oct 2002 10:23:32 +0200 To: caml-list@inria.fr Subject: Re: [Caml-list] Re: Camlp4 optimizations (was: productivity improvement) References: <200210171637.15448.jeffrey.palmer@acm.org> <3DAF4DF8.707@baretta.com> <200210171957.28279.jeffrey.palmer@acm.org> <3DAF8C58.5040002@baretta.com> Mail-Copy-To: never From: Remi VANICAT Date: Fri, 18 Oct 2002 10:23:32 +0200 In-Reply-To: <3DAF8C58.5040002@baretta.com> (Alessandro Baretta's message of "Fri, 18 Oct 2002 06:21:44 +0200") Message-ID: <874rbkjgu3.dlv@wanadoo.fr> User-Agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2 (i386-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Alessandro Baretta writes: > Jeffrey Palmer wrote: >> On Thursday 17 October 2002 6:55 pm, Alessandro Baretta wrote: >> Hmm. I have two observations: >> 1) You can't "use" templates without instantiating them, so although >> you're right - template type checking is deferred to instantiation, >> this is by design (a pain, I agree). > > It's more than a pain. John Max Skaller acutely pointed out that > templates have "no semantics". The semantics of a template depends on > the parameter(s) with which it is instantiated, and in a very bizzarre > way. Code which compiles and is correct with well-behaved > parameters--the STL, for example--becomes incorrect, won't compile, or > will miserably die at runtime with a segfault, if it is instantiated > with a parameter class redefining the basic operations--equality, > assignment, copy constructor, etc--in a such a way as to violate the > assumptions explicitly or implicitly made by the template > designer. Such errors are not revealed when the template is written > and "compiled". They are revealed at best at template instantiation > time, and possibly at runtime. > > Caml functors, on the other hand, are statically type checked at > compile time. Once and for all. If they compile, they're correct. And > that's it. Well, the Set.Make and Map.Make functor to the stdlib want the compare function of their argument to be a comparison function. This in not checked at compile time (this can't be verify). and if this not the case, you can difficultly predict the comportment of those functor. (well it won't segfault, but it may not do what you want). SO it is not so simple. >> Oh, and in response to my own earlier question regarding partial >> evaluation and strongly-typed languages, I noticed a post elsewhere >> on the list to a very interesting site: >> http://www.cs.rice.edu/~taha/MetaOCaml/ There is also dml (http://oops.tercom.ru/dml/) that don't need a patched version of ocaml... -- Rémi Vanicat vanicat@labri.u-bordeaux.fr http://dept-info.labri.u-bordeaux.fr/~vanicat ------------------- 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