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 OAA32466; Sat, 17 Nov 2001 14:34:59 +0100 (MET) 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 OAA01629 for caml-list@pauillac.inria.fr; Sat, 17 Nov 2001 14:34:59 +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 UAA27279 for ; Fri, 16 Nov 2001 20:45:06 +0100 (MET) Received: from gnu.in-berlin.de (gnu.in-berlin.de [192.109.42.4]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id fAGJj5912719 for ; Fri, 16 Nov 2001 20:45:05 +0100 (MET) Received: from hirsch.in-berlin.de (root@hirsch.colt.in-berlin.de [213.61.118.6]) by gnu.in-berlin.de (8.10.1/8.10.1) with ESMTP id fAGJj5r10828 for ; Fri, 16 Nov 2001 20:45:05 +0100 (CET) (envelope-from cle@qiao.in-berlin.de) X-Envelope-From: cle@qiao.in-berlin.de X-Envelope-To: Received: from hirsch.in-berlin.de (uucp@localhost [127.0.0.1]) by hirsch.in-berlin.de (8.12.1/8.12.1/Debian -2) with ESMTP id fAGJj4Z6025129 for ; Fri, 16 Nov 2001 20:45:04 +0100 Received: (from uucp@localhost) by hirsch.in-berlin.de (8.12.1/8.12.1/Debian -2) with UUCP id fAGJj4WL025128 for caml-list@inria.fr; Fri, 16 Nov 2001 20:45:04 +0100 Received: (qmail 60719 invoked by uid 500); 16 Nov 2001 19:37:45 -0000 Date: Fri, 16 Nov 2001 20:37:45 +0100 From: Clemens Hintze To: caml-list@inria.fr Subject: [Caml-list] [Q]: Co(ntra)variance and subtyping? Message-ID: <20011116203745.A59514@qiao.in-berlin.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.19i Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hello, I am already lurking on this list for some days. Now I would like to introduce myself. To earn my living I am working for a company writing software in area of transportation automatisation. There we are using mainly C/C++, PL/SQL, Perl and some other scripting languages. But programming is not only my business but also my hobby. So I try to grasp as much different paradigms and languages as I can get. The imperative and declarative programming (using Prolog) is already known to me (I have not said 'mastered' ;-). Now I have thought about learning functional programming. I had a closer look to OCaml, Haskell and Erlang for ca. two weeks. Although Haskell has impressed me a lot and nearly won me, I had decided to begin my first steps in OCaml. Partly due to the fact that the paradigms I am already comfortable with, are also supported, partly because of its really nice type inference scheme and modularity capabilities and last but not least due to the fact, that OCaml offers very nice compilers and a very comprehensive library to work with. But where is light, there is also some shadow. I find OCaml a really complex language -- perhaps more complex than Haskell. But, ey, C++ or Perl also can hardly be called a simple language, isn't it? And I was able to gain enough knowledge to use C++ successfully at my daily work. So I think complexity should not hinder me :-) As I have decided to learn OCaml, I am sure that I will have several questions in future, that I would like to ask here on the list, as I found comp.lang.functional do not seem very busy with OCaml topics. Two things I would like to ask you right now: - What does subtyping exactly mean in OCaml resp. functional programming? - What means covariance and contravariance of types and subtypes? I have already learned that in OCaml classes are not types like in C++. So subclasses are not be considered as subtypes. But those co(ntra)variance thingy? I have read many messages of that list in the archive. I have found some messages that deal with those terms. I have also read the OCaml documentation. I think I've got a feeling what it could mean, but if I should explain it to others, I would surely fail, i.e. I would not bet my life that I have understood these terms ;-) OTOH, these terms seem to be very important in dealing with OCaml or functional programming. So excuse me, if I ask a very stupid question, but I really had not found any me-convincing answer to this. Google also did not help me here. So if you wouldn't mind, please try to explain those terms to me. If possible with some examples. Let me thank you all in advance and happy OCaml'ing :-) Regards, Clemens. PS: Sorry, if my english is not flawless, but it is not my mother-tongue, and I do not speak french a bit, unfortunately. -- Clemens Hintze mailto: c.hintze@gmx.net ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr