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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id CE8C4800BE for ; Fri, 10 Feb 2017 10:42:44 +0100 (CET) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=leo@lpw25.net; spf=None smtp.mailfrom=leo@lpw25.net; spf=None smtp.helo=postmaster@out4-smtp.messagingengine.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of leo@lpw25.net) identity=pra; client-ip=66.111.4.28; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="leo@lpw25.net"; x-sender="leo@lpw25.net"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of leo@lpw25.net) identity=mailfrom; client-ip=66.111.4.28; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="leo@lpw25.net"; x-sender="leo@lpw25.net"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@out4-smtp.messagingengine.com) identity=helo; client-ip=66.111.4.28; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="leo@lpw25.net"; x-sender="postmaster@out4-smtp.messagingengine.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AfTg+uxbT+P/40WOyG0/DPeP/LSx+4OfEezUN459i?= =?us-ascii?q?sYplN5qZpsq4bnLW6fgltlLVR4KTs6sC0LuK9fC/EjRZqdbZ6TZZL8wKD0dEwe?= =?us-ascii?q?wt3CUeQ+e9QXXhK/DrayFoVO9jb3RCu0+BDE5OBczlbEfTqHDhpRQbGxH4KBYn?= =?us-ascii?q?br+tQt2a3IyL0LW58pjXJgFJnyaVYLVoLRzwox+CmNMRhN5GJ6F59RvIvnYAL+?= =?us-ascii?q?BbwktsPU3JwlD669vmr80ryDhZp/90r50Iaq79ZaltFbE=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0DKAwALip1YhxwEb0JdHAEBBAEBCgEBF?= =?us-ascii?q?wEBBAEBCgEBhRGDWYp6kHsfl0OGIgKCcUQTAQEBAQEBAQEBAQESAQEBCgsJCh0?= =?us-ascii?q?vQg6BYxmCHgEEASMdOgQLCwQBPQICLCuKCQivXYIlgw+FVYJzAQEBAQYBAQEBA?= =?us-ascii?q?RsIiFmCYoUgggAMLi6CMZBGhROGHQGjGZMVN4EeMigKPIRVggsiNYFhiD0BAQE?= X-IPAS-Result: =?us-ascii?q?A0DKAwALip1YhxwEb0JdHAEBBAEBCgEBFwEBBAEBCgEBhRG?= =?us-ascii?q?DWYp6kHsfl0OGIgKCcUQTAQEBAQEBAQEBAQESAQEBCgsJCh0vQg6BYxmCHgEEA?= =?us-ascii?q?SMdOgQLCwQBPQICLCuKCQivXYIlgw+FVYJzAQEBAQYBAQEBARsIiFmCYoUgggA?= =?us-ascii?q?MLi6CMZBGhROGHQGjGZMVN4EeMigKPIRVggsiNYFhiD0BAQE?= X-IronPort-AV: E=Sophos;i="5.35,140,1484002800"; d="scan'208,217";a="259696250" Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Feb 2017 10:42:43 +0100 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 5808820699 for ; Fri, 10 Feb 2017 04:42:40 -0500 (EST) Received: from web1 ([10.202.2.211]) by compute5.internal (MEProxy); Fri, 10 Feb 2017 04:42:40 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=lpw25.net; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=0MH4UIJFcYrvxSK4z7/qq5R6zf k=; b=vxfbB7OgMXy4gwmmOYFx4xh5F/Uu/7J/OP4nl+T4lWlyOq/xlwL65FK+QI EksjT8CXdLUUPegc7HOua5XQSfnGIc3v67a9IhX0Rk0T63HXfi6LbMNTMJ1gYpz5 jVTNHBy0BroNuUJE49Tb1bva/yiW0I5ZFb5IyMYPnDa0Kl8+s= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=smtpout; bh=0M H4UIJFcYrvxSK4z7/qq5R6zfk=; b=YTt58zSQ9sKlSRXwGaTqwnR77m1ZNeuWFS /wBQkpbQVUsKht2Eme+JIjzxLLRlh7mvoDymTdNKi23n3odjvI4JUyE4vNRkPMtO QdqkJncAJkHVQhAMVBbNfvi092umhSn5RQy3mrNyQ43Ga4AjY/T7hm85afXTR+hu VMo+/XWo4= X-ME-Sender: Received: by mailuser.nyi.internal (Postfix, from userid 99) id 1210BAA6C8; Fri, 10 Feb 2017 04:42:40 -0500 (EST) Message-Id: <1486719759.2807473.876601792.517B151E@webmail.messagingengine.com> From: Leo White To: caml-list@inria.fr MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: multipart/alternative; boundary="_----------=_148671975928074731" X-Mailer: MessagingEngine.com Webmail Interface - ajax-4a450d19 References: Date: Fri, 10 Feb 2017 04:42:39 -0500 In-Reply-To: Subject: Re: [Caml-list] extend object type? This is a multi-part message in MIME format. --_----------=_148671975928074731 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" You can't do it for object types directly, but you can do it for class types: class type t1 = object method f : int end class type t2 = object inherit t1 method g : bool end Defining a class type also defines the corresponding object type, which means the above results in types called t1 and t2 that are equal to the ones you want. This trick also lets you use #t2 to refer to the polymorphic type < f : int; g : bool; .. >. Regards, Leo On Thu, 9 Feb 2017, at 11:15 PM, Steffen Smolka wrote: > Is there syntax to conveniently extend object types? > Concretely, for types > > type t1 = < f : int > > type t2 = < f : int; g : bool > > > I would like a syntax that allows me to define t2 in terms of t1. > > Thanks! > -- Steffen --_----------=_148671975928074731 Content-Transfer-Encoding: 7bit Content-Type: text/html; charset="utf-8"
You can't do it for object types directly, but you can do it for class types:

  class type t1 = object method f : int end

  class type t2 = object inherit t1 method g : bool end

Defining a class type also defines the corresponding object type, which means the above results in types called t1 and t2 that are equal to the ones you want.

This trick also lets you use #t2 to refer to the polymorphic type < f : int; g : bool; .. >.

Regards,

Leo

On Thu, 9 Feb 2017, at 11:15 PM, Steffen Smolka wrote:
Is there syntax to conveniently extend object types?
Concretely, for types

type t1 = < f : int >
type t2 = < f : int; g : bool >

I would like a syntax that allows me to define t2 in terms of t1.

Thanks!
-- Steffen

--_----------=_148671975928074731--