From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id oBT0Bx98005646 for ; Wed, 29 Dec 2010 01:11:59 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgcBAJ4LGk3RVaC0lGdsb2JhbACZLop8CBUBAQEBCQsICREEIKUijA+FAYg/AQEDBYVFBIRjhiGEBoU7 X-IronPort-AV: E=Sophos;i="4.60,242,1291590000"; d="scan'208";a="71457575" Received: from mail-gy0-f180.google.com ([209.85.160.180]) by mail3-smtp-sop.national.inria.fr with ESMTP; 29 Dec 2010 01:11:54 +0100 Received: by gya6 with SMTP id 6so3767526gya.39 for ; Tue, 28 Dec 2010 16:11:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:subject:mime-version :content-type:from:x-priority:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; bh=Ejr67VjGMAMquOJ7IaEoDN714/j9aYtVABDpgxS2K8k=; b=bUrf7+AyZZ1LfaKfxPbZKlGdQZld5KUoEhNu1ybsWi/5VM3k/vmLP6NlaEcQNWjdQU YmOkDFDFAw5wxhGlUXZUT9eskNBoA+dwIzhQ9/NeUgua2qnwuE7zacrSOCEHRy9GD9u/ fbBK2xR+NKxtHQCHLRWa/alzdPDbwuW1phFOs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:subject:mime-version:content-type:from:x-priority :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to:x-mailer; b=rhngWjRyT+lnG2hvFIpkQim8CX+G3v97A2ZxQ4/VUd1Ye5JprlB/OCmo/g2wPr6056 DvR+y8ZevlXDpbvzLLQry+my0ap4FID+d3k7IXvh2O5zW+uAT0IDP10e7/kPTFeDonk8 ZbptbyLyNxOzqAIda8SOfTwBkGn1b/IOzH764= Received: by 10.150.205.9 with SMTP id c9mr18825189ybg.271.1293581513306; Tue, 28 Dec 2010 16:11:53 -0800 (PST) Received: from tet.garrigue.jp (58x158x128x157.ap58.ftth.ucom.ne.jp [58.158.128.157]) by mx.google.com with ESMTPS id 55sm7608924yhl.37.2010.12.28.16.11.51 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 28 Dec 2010 16:11:52 -0800 (PST) Sender: Jacques Garrigue Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: Jacques Garrigue X-Priority: 3 In-Reply-To: Date: Wed, 29 Dec 2010 09:11:49 +0900 Cc: caml-list@yquem.inria.fr Message-Id: <825BF6CA-5158-4669-BB57-FE751CBC5479@math.nagoya-u.ac.jp> References: <-7059986755517193363@unknownmsgid> To: Joel Reymont X-Mailer: Apple Mail (2.1082) Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id oBT0Bx98005646 Subject: Re: [Caml-list] c++ class to ocaml class or module? On 2010/12/29, at 8:26, Joel Reymont wrote: >> I would only suggest making the extra effort of combining these >> functions into classes if sutyping is actively used. > > This is a large surface C++ API where I need to subclass to provide callbacks. > > For example, the initialization arguments to the "engine" class are grouped into a "parameters" class so I need to create the parameters object in C++ and then individually set the members. As this doesn't seem to involve subtyping, I would suggest just putting your parameters into an ocaml record, and have a class on the C++ side that accesses the fields of such a record. Keep the FFI as simple as possible. If you need more structure on the ocaml side, you can always add it later. Jacques Garrigue