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 KAA30262; Fri, 18 Oct 2002 10:46:51 +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 KAA20797 for ; Fri, 18 Oct 2002 10:46:50 +0200 (MET DST) Received: from mel-rto6.wanadoo.fr (smtp-out-6.wanadoo.fr [193.252.19.25]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g9I8koD03210 for ; Fri, 18 Oct 2002 10:46:50 +0200 (MET DST) Received: from mel-rta7.wanadoo.fr (193.252.19.61) by mel-rto6.wanadoo.fr (6.5.007) id 3DA24D4D006B3FB4; Fri, 18 Oct 2002 10:46:48 +0200 Received: from iliana (80.14.205.81) by mel-rta7.wanadoo.fr (6.5.007) id 3DA24BE60067098F; Fri, 18 Oct 2002 10:46:48 +0200 Received: from luther by iliana with local (Exim 3.36 #1 (Debian)) id 182SmM-0000au-00; Fri, 18 Oct 2002 10:46:46 +0200 Date: Fri, 18 Oct 2002 10:46:46 +0200 To: Remi VANICAT Cc: caml-list@inria.fr Subject: Re: [Caml-list] Re: Camlp4 optimizations (was: productivity improvement) Message-ID: <20021018084646.GA2262@iliana> References: <200210171637.15448.jeffrey.palmer@acm.org> <3DAF4DF8.707@baretta.com> <200210171957.28279.jeffrey.palmer@acm.org> <3DAF8C58.5040002@baretta.com> <874rbkjgu3.dlv@wanadoo.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <874rbkjgu3.dlv@wanadoo.fr> User-Agent: Mutt/1.4i From: Sven Luther Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, Oct 18, 2002 at 10:23:32AM +0200, Remi VANICAT wrote: > 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). It will just do what you tell it to do, which is a feature, not a bug :))) Friendly, Sven Luther ------------------- 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