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 DB30B7EEFA for ; Mon, 9 Nov 2015 14:27:16 +0100 (CET) IronPort-PHdr: 9a23:/3o6+her1ecDZIwYU0wOfvrAlGMj4u6mDksu8pMizoh2WeGdxc6+Zx7h7PlgxGXEQZ/co6odzbGG7ua8Aiddud6oizMrTt9lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUiv2OQc9HOnpAIma153xjLDvvcGIKFgQzBOGIppMbzyO5T3LsccXhYYwYo0Q8TDu5kVyRuJN2GlzLkiSlRuvru25/Zpk7jgC86l5r50IAu3GePEzRLlcSTAnKHwd5cvxtBCFQxHcyGEbVzAtjhdGCg6NyRb8WJb8qGOus+173iiXJ+X3V7dyRDGl6btxRRbsziwOYW1quFrLg9B92foI6CmqoAZyltbZ Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=monnier@iro.umontreal.ca; spf=Pass smtp.mailfrom=gclci-caml-list@m.gmane.org; spf=Pass smtp.helo=postmaster@plane.gmane.org Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of monnier@iro.umontreal.ca) identity=pra; client-ip=80.91.229.3; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gclci-caml-list@m.gmane.org"; x-sender="monnier@iro.umontreal.ca"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of gclci-caml-list@m.gmane.org designates 80.91.229.3 as permitted sender) identity=mailfrom; client-ip=80.91.229.3; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gclci-caml-list@m.gmane.org"; x-sender="gclci-caml-list@m.gmane.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of postmaster@plane.gmane.org designates 80.91.229.3 as permitted sender) identity=helo; client-ip=80.91.229.3; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gclci-caml-list@m.gmane.org"; x-sender="postmaster@plane.gmane.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DSAAD2nkBWgQPlW1BewzkBDYdrBIE+OBQBAQEBAQEBARABARYzLoIugggBBAF+Cws0EhQoG4g/DAHALYtShSeEEgWOEYg3qCSBSB8BAYIMAQEBBwIBOh2BdCCGGgEBAQ X-IPAS-Result: A0DSAAD2nkBWgQPlW1BewzkBDYdrBIE+OBQBAQEBAQEBARABARYzLoIugggBBAF+Cws0EhQoG4g/DAHALYtShSeEEgWOEYg3qCSBSB8BAYIMAQEBBwIBOh2BdCCGGgEBAQ X-IronPort-AV: E=Sophos;i="5.20,266,1444687200"; d="scan'208";a="153214205" Received: from plane.gmane.org ([80.91.229.3]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES256-SHA; 09 Nov 2015 14:27:16 +0100 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZvmTX-0003m5-I6 for caml-list@inria.fr; Mon, 09 Nov 2015 14:27:12 +0100 Received: from 184-175-11-171.dsl.teksavvy.com ([184-175-11-171.dsl.teksavvy.com]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 09 Nov 2015 14:27:11 +0100 Received: from monnier by 184-175-11-171.dsl.teksavvy.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 09 Nov 2015 14:27:11 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr From: Stefan Monnier Date: Mon, 09 Nov 2015 08:27:02 -0500 Message-ID: References: <0F7D3B1B3C4B894D824F5B822E3E5A172CE3E070@IRSMSX102.ger.corp.intel.com> <87pozk6vjp.fsf@mid.deneb.enyo.de> <87y4e7662z.fsf@mid.deneb.enyo.de> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 184-175-11-171.dsl.teksavvy.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:kjqiD5ADmUGTRn3hAjb/iW4PybM= X-Validation-by: monnier@iro.umontreal.ca Subject: Re: [Caml-list] Newbie comment on constructor syntax >> However the following works: >> # type x = X of (int * int);; >> type x = X of (int * int) >> # let c = (1, 2) in X c;; >> - : x = X (1, 2) > With multiple constructors per type at least, this has a different > in-memory representation: two objects (the constructed value and a > tuple which the value references). Of course, SML (being the less pragmatic brother) does not have this "wart" and treats "X of int * int" the same as "X of (int * int)". But this indeed comes at the cost of a less efficient representation. You can try to "optimize" this away, but it becomes tricky when you start using functors where type "t" is a parameter and you have a constructor "X of t". IOW, there were good pragmatic reasons to introduce this "wart". This said I think Haskell shows that using a curried constructor nicely circumvents the problem (of course it comes at the cost of not being able to do the equivalent of "X of t", but that doesn't seem to be much of a problem in practice, especially for Haskell where there are no functors anyway). Stefan