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 1C50A7F6C4 for ; Thu, 23 Jan 2014 10:35:56 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of arnaud.spiwack@gmail.com) identity=pra; client-ip=209.85.216.45; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="arnaud.spiwack@gmail.com"; x-sender="arnaud.spiwack@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of arnaud.spiwack@gmail.com designates 209.85.216.45 as permitted sender) identity=mailfrom; client-ip=209.85.216.45; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="arnaud.spiwack@gmail.com"; x-sender="arnaud.spiwack@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-qa0-f45.google.com) identity=helo; client-ip=209.85.216.45; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="arnaud.spiwack@gmail.com"; x-sender="postmaster@mail-qa0-f45.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AioCACjh4FLRVdgtlGdsb2JhbABbhBqCfrl8CBYOAQEBAQcLCwkSKoIcCQEBAQMBIx0BOAEDAQsBBQUDAQc3AgIiEgEFARwGG4dpAwkInQiMCYNckjUnDYVWEQEFDJFmgUkEmCKQKxgpgWWCdTs X-IPAS-Result: AioCACjh4FLRVdgtlGdsb2JhbABbhBqCfrl8CBYOAQEBAQcLCwkSKoIcCQEBAQMBIx0BOAEDAQsBBQUDAQc3AgIiEgEFARwGG4dpAwkInQiMCYNckjUnDYVWEQEFDJFmgUkEmCKQKxgpgWWCdTs X-IronPort-AV: E=Sophos;i="4.95,705,1384297200"; d="scan'208";a="54484475" Received: from mail-qa0-f45.google.com ([209.85.216.45]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 23 Jan 2014 10:35:55 +0100 Received: by mail-qa0-f45.google.com with SMTP id ii20so1843508qab.4 for ; Thu, 23 Jan 2014 01:35:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=uCU8f0nN3D6xwM7vJqWx/SCxdJLK5jlyv5edXmCHa7g=; b=CuxlzTtbxJeMEcfMiPM2sIbVmW3QOx8eeDVKEBI+Vo1fRJgdHEwXpNB2jVMpBBUwVr 6lthEsAL0AVrIxkwD80kCyHn9tSMPVDvcTCGByv2CLkJZMOTCLUS8vXLiEmgJ04XN7Ah qr/TSUHiYQ2+gdKd4otLuAcDVCDBRjoTqsZdUIhIyj2Nr3kMJ2VJgEeaEVdBGNUOnztH kUiRp5JkGtCAZ3clYGjIzE+xVTRVPkbCEXFWo6FyTAJ76G+rqmKBqYKXJ4Ru2wTE1LRb cbgBZlAciw50zyigfbR/+zh0F8ICFgyBFfrfzwC8UAxs+22WvMmVtOTcjzXs74ZjAn2C hd8w== X-Received: by 10.140.38.11 with SMTP id s11mr9240627qgs.62.1390469754477; Thu, 23 Jan 2014 01:35:54 -0800 (PST) MIME-Version: 1.0 Sender: arnaud.spiwack@gmail.com Received: by 10.96.198.6 with HTTP; Thu, 23 Jan 2014 01:35:14 -0800 (PST) In-Reply-To: <20140123092009.GA20624@frosties> References: <20140121094939.GA13578@frosties> <20140123092009.GA20624@frosties> From: Arnaud Spiwack Date: Thu, 23 Jan 2014 10:35:14 +0100 X-Google-Sender-Auth: VGQrDx8LwFbDTvCBztzPBlElOJ8 Message-ID: To: Goswin von Brederlow Cc: OCaML Mailing List Content-Type: multipart/alternative; boundary=001a11c128a8c95cad04f09ff75e X-Validation-by: arnaud@spiwack.net Subject: Re: [Caml-list] Purity in ocaml --001a11c128a8c95cad04f09ff75e Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable > On the other hand if types are annotated with the exceptions they > throw then they become just another return value and become pure. > Same input, same exception every time. > As far as Yotam Barnoy's goal is concerned, this isn't true. He wants to be able to use purity annotations for optimisation: a most typical optimisation which is valid only for pure functions is to rewrite *map f (map g l)* into *map (f=E2=88=98g) l*. This optimisation, as it happens, is= not valid with exception throwing functions as it may very well throw a different exception. --001a11c128a8c95cad04f09ff75e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

=
On the other hand if types are annotated with the exceptions they
throw then they become just another return value and become pure.
Same input, same exception every time.

As far=20 as Yotam Barnoy's goal is concerned, this isn't true. He wants to b= e=20 able to use purity annotations for optimisation: a most typical=20 optimisation which is valid only for pure functions is to rewrite map f = (map g l) into map (f=E2=88=98g) l. This optimisation, as it hap= pens, is not valid with exception throwing functions as it may very well th= row a different exception.
--001a11c128a8c95cad04f09ff75e--