From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 1D49D7EE34 for ; Wed, 30 Mar 2016 12:28:11 +0200 (CEST) IronPort-PHdr: 9a23:c5zZ7xNGpLBu8SFlQKkl6mtUPXoX/o7sNwtQ0KIMzox0KPr5rarrMEGX3/hxlliBBdydsKIUzbCG+PqwEUU7or+/81k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i760zceF13FOBZvIaytQ8iJ35TxjbD5oc2bSj4LrQT+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf9d32JiKAHbtR/94sCt4MwrqHwI6Lpyv/JHBK7zeqBwUKdVFi9uZ2s84cmusRjYUSOO4GEdWyMYiEwbLRLC6UTRXo3wqTf9rupK+LeVMNe+Gbs0QzW586BzSFnojyoIOiQR7HySgMFqiKNd5h6s8U8si7XIaZ2YYaItNpjWeskXEDJM Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=christoph.hoeger@tu-berlin.de; spf=None smtp.mailfrom=christoph.hoeger@tu-berlin.de; spf=None smtp.helo=postmaster@mail.tu-berlin.de Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of christoph.hoeger@tu-berlin.de) identity=pra; client-ip=130.149.7.33; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="christoph.hoeger@tu-berlin.de"; x-sender="christoph.hoeger@tu-berlin.de"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of christoph.hoeger@tu-berlin.de) identity=mailfrom; client-ip=130.149.7.33; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="christoph.hoeger@tu-berlin.de"; x-sender="christoph.hoeger@tu-berlin.de"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail.tu-berlin.de) identity=helo; client-ip=130.149.7.33; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="christoph.hoeger@tu-berlin.de"; x-sender="postmaster@mail.tu-berlin.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CUAQB8qftWkyEHlYJdhQOoUJQph087EQEBAQEBAQEBEAEBAQEJCwkJIS+CLYI+DwE4DTYCBRYLAgsDAgECAUsNBgIBAYgjBKACj12RIHyRJYJWBZdtgSuWEIVZjxA2gWIBC1KBU2qIPwEBAQ X-IPAS-Result: A0CUAQB8qftWkyEHlYJdhQOoUJQph087EQEBAQEBAQEBEAEBAQEJCwkJIS+CLYI+DwE4DTYCBRYLAgsDAgECAUsNBgIBAYgjBKACj12RIHyRJYJWBZdtgSuWEIVZjxA2gWIBC1KBU2qIPwEBAQ X-IronPort-AV: E=Sophos;i="5.24,415,1454972400"; d="scan'208";a="171624735" Received: from mail.tu-berlin.de ([130.149.7.33]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Mar 2016 12:28:10 +0200 X-tubIT-Incoming-IP: 91.66.50.149 Received: from ip5b423295.dynamic.kabel-deutschland.de ([91.66.50.149] helo=[192.168.178.42]) by mail.tu-berlin.de (exim-4.76/mailfrontend-7) with esmtpsa [UNKNOWN:AES128-SHA:128] for id 1alDM8-0006nL-0y; Wed, 30 Mar 2016 12:28:09 +0200 To: caml users From: =?UTF-8?Q?Christoph_H=c3=b6ger?= Organization: =?UTF-8?Q?Technische_Universit=c3=a4t_Berlin?= Message-ID: <56FBAA37.5080403@tu-berlin.de> Date: Wed, 30 Mar 2016 12:28:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2016.3.30.102116 X-PMX-Spam: Gauge=IIIIIII, Probability=0%, Report='' Subject: [Caml-list] Infer least upper bound for arguments to functions in rows Dear experts, is there a way to infer a compatible type for the argument to t#x in the function: let a t = ignore (t#x t) ; t#x (object end) ;; I can easily provide a compatible t, e.g.: let t = object method x _ = 23 end I can also use a coercion: let a t = ignore (t#x (t :> < >)) ; t#x (object end) ;; Since < > is the common supertype of both arguments. My problem is that in general < > won't suffice for the common type, and finding it is a rather complicated process. So I wonder if there is some clever rewriting of the function that makes ocamlc infer that type for me? Is there any expression that for two (expressions with) different input types yields (an expression of) the largest common supertype? regards, Christoph -- Christoph Höger Technische Universität Berlin Fakultät IV - Elektrotechnik und Informatik Übersetzerbau und Programmiersprachen Sekr. TEL12-2, Ernst-Reuter-Platz 7, 10587 Berlin Tel.: +49 (30) 314-24890 E-Mail: christoph.hoeger@tu-berlin.de