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 JAA24141; Mon, 17 Feb 2003 09:01:50 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA24146 for caml-list@pauillac.inria.fr; Mon, 17 Feb 2003 09:01:49 +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 QAA22014 for ; Fri, 14 Feb 2003 16:33:57 +0100 (MET) Received: from ariel.yandex.ru (ariel.yandex.ru [213.180.193.62]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h1EFXuP28950 for ; Fri, 14 Feb 2003 16:33:56 +0100 (MET) Received: from YAMAIL (ariel.yandex.ru) by mail.yandex.ru id ; Fri, 14 Feb 2003 18:33:49 +0300 Date: Fri, 14 Feb 2003 18:33:46 +0300 (MSK) From: "inv2002" Reply-To: inv2002@yandex.ru Message-Id: <3E4D0C5A.000016.04257@ariel.yandex.ru> MIME-Version: 1.0 X-Mailer: Yamail [ http://yandex.ru ] To: garrigue@kurims.kyoto-u.ac.jp Cc: inv2002@yandex.ru, caml-list@inria.fr Subject: Re: [Caml-list] Problem with classes or i need help In-Reply-To: <20030206094439M.garrigue@kurims.kyoto-u.ac.jp> References: <3E4184BF.000014.23165@ariel.yandex.ru> <20030206094439M.garrigue@kurims.kyoto-u.ac.jp> X-source-ip: 213.147.49.211 Content-Type: text/plain; charset="KOI8-R" Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk >> class virtual figure () = >> object >> method virtual to_string: string >> end >[...] >> class screen () = >> object >> val mutable figures = [] >> method add_figure f = >> figures <- (f#to_string ) :: figures >> end >[...] >> The method add_figure has type < to_string : 'a; .. > -> unit where .. >> is unbound >> >> I understand the problem, but i don't know solution, help, please. > >Are you sure you understood ?-) >There's nothing in your program to tell the compiler that the argument > method add_figure : 'a. (#figure as 'a) -> unit = fun f -> > figures <- f#to_string :: figures > >Jacques Garrigue thanks, i'd try (f:figure) but a need inherit. and now is a second problem: method add_figure : 'a. (#figure as 'a) -> string -> unit = fun f k -> Hashtbl.add figures k f#to_string work correctly, but method add_figure : string -> 'a. (#figure as 'a) -> unit = fun k f -> Hashtbl.add figures k f#to_string return syntax error, can i define method add key figure = ... ??? -- Сегодня удачный день, чтобы завести почту на Яндексе (http://mail.yandex.ru) ------------------- 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