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 SAA17496; Mon, 24 Mar 2003 18:50:52 +0100 (MET) 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 SAA17411 for ; Mon, 24 Mar 2003 18:50:51 +0100 (MET) Received: from mail0.epfl.ch (mail0.epfl.ch [128.178.50.57]) by nez-perce.inria.fr (8.11.1/8.11.1) with SMTP id h2OHopX07295 for ; Mon, 24 Mar 2003 18:50:51 +0100 (MET) Received: (qmail 30256 invoked from network); 24 Mar 2003 17:50:50 -0000 Received: from lamppc32.epfl.ch (HELO epfl.ch) (128.178.154.41) by mail0.epfl.ch with SMTP; 24 Mar 2003 17:50:50 -0000 Message-ID: <3E7F457A.80006@epfl.ch> Date: Mon, 24 Mar 2003 18:50:50 +0100 From: Sebastien Briais User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en, fr-fr MIME-Version: 1.0 To: caml-list@inria.fr Subject: Re: [Caml-list] About polymorphic methods and recursive classes References: <3E7C4784.6000901@epfl.ch> <20030324094415.6679de19.Damien.Pous@ens-lyon.fr> In-Reply-To: <20030324094415.6679de19.Damien.Pous@ens-lyon.fr> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit X-Spam: no; 0.00; caml-list:01 inferred:01 ocaml:01 inherit:01 int:01 polymorphic:01 classes:03 interpreter:03 recursive:03 nil:03 object:03 types:03 sebastien:03 epfl:05 seems:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > > >># class virtual ['a] visitor = >> object >> method virtual caseNil : 'a >> end >> and virtual int_list = >> object >> method virtual visit : 'a.('a visitor -> 'a) >> end >> ;; >>class virtual ['a] visitor : object method virtual caseNil : 'a end >>class virtual int_list : object method virtual visit : 'a visitor -> >>'a end >> >># class nil = >> object >> inherit int_list >> method visit v = v#caseNil >> end >> ;; >>This expression has type 'a visitor >>It has no method caseNil >> >> > >it seems to work with class types : > > ok, but it does not answer my question. I am still puzzled by the answer of the interpreter which says me that "v has type 'a visitor; It has no method caseNil" although it has inferred just before that "class virtual ['a] visitor : object method virtual caseNil : 'a end" Moreover, it seems odd to me that it works with class types but not without. These class types should be inferred by Ocaml, shouldn't they ? (and they seems to be correctly inferred in my example (in the first part of it)) So I ask again : how should I interpret the error message given by ocaml ? Regards Sébastien ------------------- 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