From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 6D64EBB84 for ; Tue, 1 Jul 2008 15:53:39 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmQFAGPTaUhREHVi/2dsb2JhbACBWrBy X-IronPort-AV: E=Sophos;i="4.27,731,1204498800"; d="scan'208";a="26906556" Received: from mail2.rutube-team.ru (HELO office.stork.ru) ([81.16.117.98]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 01 Jul 2008 15:53:38 +0200 Received: from serp.office.stork.ru (serp [192.168.21.130]) by office.stork.ru (8.13.5/8.13.5) with ESMTP id m61DrbXA011361 for ; Tue, 1 Jul 2008 17:53:38 +0400 Message-ID: <486A36DE.4040605@stork.ru> Date: Tue, 01 Jul 2008 17:53:34 +0400 From: SerP User-Agent: Thunderbird 2.0.0.14 (X11/20080501) MIME-Version: 1.0 To: caml-list Subject: Open class types Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; mli:01 .....:98 inline:01 inline:01 int:01 int:01 define:02 expression:02 string:02 string:02 let:03 compiled:04 types:05 exists:05 definition:07 class type location_t = object method a: int; method b: string; end; class type session_t = object method id:int; method location: #location_t; end; value check_session (session:#session_t) = begin print_int session#id; print_int session#location#a; print_string session#location#b; end; class location = object method a = 1; method b = "b"; method c = ["a";"b"]; end; class session = object value location = new location; method id = 1; method location = location; end; value _ = let s = new session in check_session s; ==================================== Error: This expression has type session = < id : int; location : location > but is here used with type #session_t as 'a = < id : int; location : 'b. #location_t; .. > Type location = < a : int; b : string; c : string list > is not compatible with type 'b The second object type has no method c -------------------------------------------- But, value check_session (session:< id : int; location : < a : int; b : string; .. >; .. >) = begin ..... Compiled properly. Please help. Is exists any way to define open class type like inline type definition. Write every function with inline type definition in mli files is terrible.