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.3 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 6AF8BBBC4 for ; Wed, 1 Apr 2009 20:48:51 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AowAAL5T00lCbwQbk2dsb2JhbACWFAEBAQEJCQoJEQS6YIN7Bg X-IronPort-AV: E=Sophos;i="4.38,431,1233529200"; d="scan'208";a="26825287" Received: from out3.smtp.messagingengine.com ([66.111.4.27]) by mail1-smtp-roc.national.inria.fr with ESMTP; 01 Apr 2009 20:48:50 +0200 Received: from compute2.internal (compute2.internal [10.202.2.42]) by out1.messagingengine.com (Postfix) with ESMTP id 47D8830CEAD; Wed, 1 Apr 2009 14:48:50 -0400 (EDT) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute2.internal (MEProxy); Wed, 01 Apr 2009 14:48:50 -0400 X-Sasl-enc: kB2om09hvBVB/tLGMktTCKqf7RfAUUB4gWGFDkOf4ago 1238611729 Received: from [192.168.1.10] (ALyon-157-1-87-173.w90-37.abo.wanadoo.fr [90.37.198.173]) by mail.messagingengine.com (Postfix) with ESMTPSA id 8CF9013093; Wed, 1 Apr 2009 14:48:49 -0400 (EDT) Message-ID: <49D3B64B.6070505@ens-lyon.org> Date: Wed, 01 Apr 2009 20:45:31 +0200 From: Martin Jambon User-Agent: Thunderbird 2.0.0.17 (X11/20081008) MIME-Version: 1.0 To: Goswin von Brederlow Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Bug? Constraints get ignored in methods References: <87ab71ic1f.fsf@frosties.localdomain> <49D2A0AF.1080300@ens-lyon.org> <87prfx6xsc.fsf@frosties.localdomain> <49D35307.4000502@ens-lyon.org> <87wsa49xjr.fsf@frosties.localdomain> In-Reply-To: <87wsa49xjr.fsf@frosties.localdomain> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; ens-lyon:01 bug:01 ens-lyon:01 mutable:01 wrote:01 caml-list:01 constraint:01 writes:01 jambon:01 jambon:01 data:02 data:02 constraints:03 let:03 let:03 Goswin von Brederlow wrote: > Martin Jambon writes: > >> Would the following work for you: > > No. Not just like this. > >> type 'a linked = { >> data : 'a; >> mutable next : < > linked option >> } >> (* constraint 'a = < .. > *) >> >> let create data next = { >> data = data; >> next = (next :> < > linked option) >> } >> >> let set_next x y = >> x.next <- (y :> < > linked option) >> >> >> class s = >> object >> method s = "abc" >> end >> >> class i = >> object >> method i = 123 >> end > > class s and i have no access to the linked type. Yes, that's exactly what I'm trying to achieve. They are contained in cells of the list. You need to handle cells if you want to change the linkage. > You could not remove > a class s or i from the linked structure in O(1) from within class s > or i. So linked would have to handle any function that might require > altering the linked structure and pass parts of it to its data. But > data is an unknown type so no method of it can be called. < > is your base class. Replace it by whatever you like. Martin -- http://mjambon.com/