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 57EC27EC6E for ; Fri, 17 Jan 2014 14:46:27 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of nicolas.braudsantoni@gmail.com) identity=pra; client-ip=74.125.83.44; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="nicolas.braudsantoni@gmail.com"; x-sender="nicolas.braudsantoni@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of nicolas.braudsantoni@gmail.com designates 74.125.83.44 as permitted sender) identity=mailfrom; client-ip=74.125.83.44; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="nicolas.braudsantoni@gmail.com"; x-sender="nicolas.braudsantoni@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ee0-f44.google.com) identity=helo; client-ip=74.125.83.44; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="nicolas.braudsantoni@gmail.com"; x-sender="postmaster@mail-ee0-f44.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ar0CAJFf2FJKfVMslGdsb2JhbABZvyqBDxYOAQEBAQcLCwkSKoIlAQEBBEABGx4DDAYFCw0JJQ8CEhEBBQEcEwgBAYdrAQMRBZ0WjFyDCZIUChknDWSEchEBBQyOehaEIgSQOoExglCDZoZGiWRBhFo X-IPAS-Result: Ar0CAJFf2FJKfVMslGdsb2JhbABZvyqBDxYOAQEBAQcLCwkSKoIlAQEBBEABGx4DDAYFCw0JJQ8CEhEBBQEcEwgBAYdrAQMRBZ0WjFyDCZIUChknDWSEchEBBQyOehaEIgSQOoExglCDZoZGiWRBhFo X-IronPort-AV: E=Sophos;i="4.95,670,1384297200"; d="asc'?scan'208";a="45179306" Received: from mail-ee0-f44.google.com ([74.125.83.44]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 17 Jan 2014 14:46:26 +0100 Received: by mail-ee0-f44.google.com with SMTP id c13so2141279eek.3 for ; Fri, 17 Jan 2014 05:46:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=+CiuyKdwkHkLxya/PUBRmh74tstfUJKrSL6hp8zM7T8=; b=g0hcQGjbEmir8/HgpS5iCxPbR5QXvgL94LnqpW6qShaTZbj2qXe5ElwXvekHf0KeEP cjWqRg7JFOuVAMGxNnb2GNMT9KNCvyu2iD8ZuNA3jlZz3EwSWONZZw/U18u+WTL4LPsC ic5oFDrjV3zP0wkbn1PbZdEGUuu4t8Rgnbq9sW6x+uo9KTe9cqHmg5QSgYKYUWmtpxSH En0/DynIPyiv2n0KzdESR2iomJ7QhDMynjUY7/wuZ7hfO54shGFnR0e4vuk9X1oNGTrb hVESPZMxd6X+geOf3oIABzdicAohY+Ncx0v/sHJC7lQMlujXSPzFmlOnC4fWYIUeDlag 89jw== X-Received: by 10.14.37.131 with SMTP id y3mr2543148eea.1.1389966386192; Fri, 17 Jan 2014 05:46:26 -0800 (PST) Received: from [129.27.142.163] (hp13.student.iaik.tugraz.at. [129.27.142.163]) by mx.google.com with ESMTPSA id k41sm3020174eey.0.2014.01.17.05.46.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Jan 2014 05:46:24 -0800 (PST) Message-ID: <52D9342B.30704@gmail.com> Date: Fri, 17 Jan 2014 14:46:19 +0100 From: Nicolas Braud-Santoni User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: caml-list@inria.fr References: In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vhtKXwhcfuAIt4crsU4M2VksMB6GhcUcA" Subject: Re: [Caml-list] How much optimized is the 'a option type ? This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --vhtKXwhcfuAIt4crsU4M2VksMB6GhcUcA Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 17/01/2014 12:23, Jonathan Kimmitt wrote: > In my humble opinion the main purpose of Some _ | None is to avoid the > requirement for a nil pointer in OCaml. If an external function wants to > return nil in order to indicate, for example that a certain resource is n= ot > available, it can return None instead and this prevents dereferencing a n= il > pointer in OCaml because the None cannot be dereferenced. Yes. This doesn't forbid the compiler from representing 'a option values as pointers. Indeed, the type system already enforces that the None case is handled and the representation of None and Some _ do not matter. That said, I agree with Gabriel Scherer : adding optimizations specific to 'a option might refrain people wanting to switch to more appropriate datatypes. However, would is be possible to =93optimize away=94 all types of the form =93type 'a t =3D X of 'a | A | B | ...=94 (with at most one non-constant constructor) ? Would it be worth doing ? Kind regards, Nicolas --vhtKXwhcfuAIt4crsU4M2VksMB6GhcUcA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJS2TQvAAoJEPv4tP2UoeSej0UP/jdIUbrJmf7DCXjlGHDerrwP 1G5fhc3hqcJ0Chaq4L7sBV9bs8y5I+degimLJ+lvCgPY6fUt2Fpy5zX4HQkwjbme hJe2iT9dzaaCqgPnm8ZTjpdVY+L/jFWCp86dddBdKwE9uqibrabgX1TmCZ6BRAhA vyHx/tQ7+AMIoN9f8S2qSJ1yjLV681qKj12TREyKNxBc2A71tJ37vE/VSJxeA1r0 ahBjKp8fawQMcnH9BnZtK7fEh0+80e90Wcjgl7zM5qvMaqQ5ZbIFoMBERCpt/rPJ fbhAFvQxAB60H31+Rw/QIJ5IMDw4ky6T7XmDvT19mMrXjkCdaPMSWe6D1BnMqZyp oIYi9MAL+TpCvavxvnYi739zwRM5sdWnRDqdc+i4fXtWXLL17xT6mbWjnLBs2LkI GJcLxLmjcWqW2MvGMzMdQGA/aEkiWQkcWfZTILZvNPV+Sm0Ssd1lPQzGQgEdPjBa CnMawVpp+tqpUnryQ8WH7D9iAd9TEb+68eDIWILbiJ6qKM62OSAlDT2+nZl9on/m oIHBeVUOb2xDTdmgadWUERY1sypNNSRVyrYnT9oPV7+NH2l3ZDrY5euoOheKlJ7Y FuyVWtuoENOYJLP0wqXASqpNgM0NCFEJGkir1XXQ5A7bq1KIpC4ka7ctDwDpIZJ1 DLFQRw8cZxOaoFDBtxs5 =bw7C -----END PGP SIGNATURE----- --vhtKXwhcfuAIt4crsU4M2VksMB6GhcUcA--