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 CAA05987; Fri, 19 Apr 2002 02:51:55 +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 CAA06036 for ; Fri, 19 Apr 2002 02:51:54 +0200 (MET DST) Received: from wetware.wetware.com (wetware.wetware.com [199.108.16.1]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g3J0pqL18562 for ; Fri, 19 Apr 2002 02:51:53 +0200 (MET DST) Received: from (local broken client) localhost(dh05.wetware.com[199.108.16.45]) (2064 bytes) by wetware.wetware.com via sendmail with P:esmtp/R:bind_hosts/T:inet_zone_bind_smtp (sender: ) id for ; Thu, 18 Apr 2002 17:51:51 -0700 (PDT) (Smail-3.2.0.114 2001-Aug-6 #1 built 2002-Jan-4) Date: Thu, 18 Apr 2002 17:51:52 -0700 Subject: Re: [Caml-list] Is a Cow an Animal? Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v481) Cc: caml-list@inria.fr To: Remi VANICAT From: james woodyatt In-Reply-To: <87y9fkilme.dlv@wanadoo.fr> Message-Id: Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.481) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thursday, April 18, 2002, at 05:21 PM, Remi VANICAT wrote: > james woodyatt writes: >> >> I borrowed a technique I learned here from Brian Rogoff that uses an >> abstract type with a contravariant type parameter for passing the type >> of energy a food object contains to an animal object that can eat it. >> (I wish I were smart enough to know the name for this technique.) > > the use of an abstract type with a covariant or contravariant type (or > even not variant) parameter, and where the actual implementation of > the type doesn't use this parameter (as in type 'a eater = int) is > often call phantom type. > > one can read the very interesting mail about this in the archive of > this mailing list > http://caml.inria.fr/archives/200109/msg00097.html That's precisely where I learned the technique. It's true I forgot the "phantom type" terminology, but the contribution I was trying to make to the list is that such types are frequently useful in representing complicated associations between related class hierarchies. I don't think Pixel's exercise is really covered well by the "subject-observer" pattern, and I wonder if the pattern I used in my solution is one that is already identified by a better name than the "association-by-phantom-type" pattern. Surely somebody has already published a paper on this by now, right? -- j h woodyatt ------------------- 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