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 TAA30207; Sun, 28 Apr 2002 19:05:00 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA30143 for caml-list@pauillac.inria.fr; Sun, 28 Apr 2002 19:04:59 +0200 (MET DST) 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 AAA22173 for ; Sun, 28 Apr 2002 00:44:39 +0200 (MET DST) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from sj1-3-4-9.securesites.net (sj1-3-4-9.securesites.net [192.220.127.202]) by nez-perce.inria.fr (8.11.1/8.11.1) with SMTP id g3RMibT26212 for ; Sun, 28 Apr 2002 00:44:38 +0200 (MET DST) Received: (qmail 79691 invoked by uid 16863); 27 Apr 2002 22:44:36 -0000 Received: from unknown (HELO localhost) ([192.220.65.223]) (envelope-sender ) by 192.220.65.223 (qmail-ldap-1.03) with SMTP for ; 27 Apr 2002 22:44:36 -0000 Date: Sat, 27 Apr 2002 22:44:36 +0000 (GMT) From: Brian Rogoff To: John Max Skaller cc: Nadji.Gauthier@lip6.fr, Subject: Re: [Caml-list] Polymorphic Variants and Number Parameterized Types In-Reply-To: <3CC9FC39.9090406@ozemail.com.au> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sat, 27 Apr 2002, John Max Skaller wrote: > Nadji.Gauthier@lip6.fr wrote: > > >*disclaimer* > >This is a long mail, that probably only polymorphic > >variant adepts and static typing fanatics (like me) will like. > >Moreover I strongly doubt that it could be very useful. > >*end of disclaimer* Nice tricks Nadji! I didn't have time to try out everything you showed, but I think that trick is more powerful than the other one, which doesn't use variants. Also, I'm willing to bet that you uncovered a bug in the type checker (with the "variables can't be generalized" only when in the compiler). Have you filed a bug report yet? > There is one importance of such demonstrations: they act as a proof > that adding integer constants to the static type systems is > 'safe and sound'. I think if you're going to take the conclusion that all of these tricks are worthwhile, you'll want a language with dependent types. In the general case, you may get undecidable typing (like Cayenne, which is very very cool) but there are also restricted systems like Xi's DeCaml which may be useful. > Of course, C++ is ahead here, it already admits generics parameterised > by both types and integers .. It could be useful when modeling electronic components to have the bitwidth of a component as part of a type, and to be able to say stuff in the type system about how that width changes as we build components. There was a neat posting in c.l.f. recently about such a trick using (non-"standard" features of) Haskell. I don't think C++ or Ada generics (which also parameterize over values) help you much there. Besides, ML uses the module system to parameterize over values. -- Brian ------------------- 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