220 11044 <538777A8.4050706@hyc.io> article
Path: news.gmane.org!not-for-mail
From: Pierre Talbot <ptalbot@hyc.io>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: N4015: A proposal to add a utility class to
 represent expected monad
Date: Thu, 29 May 2014 20:08:40 +0200
Lines: 71
Approved: news@gmane.org
Message-ID: <538777A8.4050706@hyc.io>
References: <94ded66f-1c50-47b9-8a04-b83805443da9@isocpp.org> <1534916.IcxgtEDE2B@drako> <5384FDF2.6060904@hyc.io> <2524692.K0qNjsgtn9@drako>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Trace: ger.gmane.org 1401809573 27831 80.91.229.3 (3 Jun 2014 15:32:53 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Tue, 3 Jun 2014 15:32:53 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDH7J5FDT4ERBH6VW6OAKGQEHLGLONQ@isocpp.org Tue Jun 03 17:32:48 2014
Return-path: <std-proposals+bncBDH7J5FDT4ERBH6VW6OAKGQEHLGLONQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lb0-f198.google.com ([209.85.217.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDH7J5FDT4ERBH6VW6OAKGQEHLGLONQ@isocpp.org>)
	id 1Wrqhj-0005Ac-Oq
	for gclcip-std-proposals@m.gmane.org; Tue, 03 Jun 2014 17:32:47 +0200
Original-Received: by mail-lb0-f198.google.com with SMTP id l4sf4019296lbv.5
        for <gclcip-std-proposals@m.gmane.org>; Tue, 03 Jun 2014 08:32:47 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to
         :subject:references:in-reply-to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type:content-transfer-encoding;
        bh=R31LkZwuPdPu1++Gi+Z4Q6NF5o26ucUL+IkJidut5Oc=;
        b=au5Tya9VaPGWspJohvQvVSyguOH7ISNzmCtrR+eHL7WoH3h7vnBlw0tLt3NnRXVqB/
         FwR1JWgMNZ2VmQ54Mtv9Ol6GnFy2ufU+QPnaAybQDadPEYPwxpZNQXyoBPn/6gZlHHYe
         mrukA1JPWpZNyTTonwZtGNH53cMm/RWz2twTTO46lB7DZUhuQNCOg06Hnp+vlMtP9sWd
         PhWuHa2nwnGuNjbMK+RAxQTkc3rDRneu/dGFRD3YyvOzGOPdJnYDg6yEibys6X7kv+oq
         W3VcH2yKkdJLs7G8aAFRc9v1aKj/5SX2F/Bzw32apteWaqs3Ionb3AT4Vj0DiqhqipqD
         OFW 
X-Gm-Message-State: ALoCoQmxytOUUsSST7okJW7Z/qqA2kNwyGOIWIUGQPCAPUvRw3xb7I+KBcxVR0obyUh9tWiTkmuX
X-Received: by 10.152.29.169 with SMTP id l9mr3886671lah.3.1401809567449;
        Tue, 03 Jun 2014 08:32:47 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.152.36.39 with SMTP id n7ls449849laj.80.gmail; Tue, 03 Jun
 2014 08:32:46 -0700 (PDT)
X-Received: by 10.112.137.138 with SMTP id qi10mr3970006lbb.4.1401809566545;
        Tue, 03 Jun 2014 08:32:46 -0700 (PDT)
Original-Received: by 10.194.100.38 with SMTP id ev6mswjb;
        Thu, 29 May 2014 11:09:06 -0700 (PDT)
X-Received: by 10.180.107.130 with SMTP id hc2mr49001273wib.7.1401386946528;
        Thu, 29 May 2014 11:09:06 -0700 (PDT)
Original-Received: from xvm-161-161.ghst.net ([2001:4b98:dc0:47:216:3eff:fe48:3630])
        by mx.google.com with ESMTPS id mz5si22246332wic.67.2014.05.29.11.08.58
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=RC4-SHA bits=128/128);
        Thu, 29 May 2014 11:08:58 -0700 (PDT)
Received-SPF: none (google.com: ptalbot@hyc.io does not designate permitted sender hosts) client-ip=2001:4b98:dc0:47:216:3eff:fe48:3630;
Original-Received: from [192.168.1.17] (nsg93-8-88-175-59-164.fbx.proxad.net [88.175.59.164])
	(using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
	(No client certificate requested)
	by xvm-161-161.ghst.net (Postfix) with ESMTPSA id 3F8C72C0CF
	for <std-proposals@isocpp.org>; Thu, 29 May 2014 20:08:40 +0200 (CEST)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0
In-Reply-To: <2524692.K0qNjsgtn9@drako>
X-Original-Sender: ptalbot@hyc.io
X-Original-Authentication-Results: mx.google.com;       spf=neutral
 (google.com: ptalbot@hyc.io does not designate permitted sender hosts) smtp.mail=ptalbot@hyc.io
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:11044
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/11044>

On 05/28/2014 11:10 PM, Ivan =C4=8Cuki=C4=87 wrote:
> Hi Pierre,
>
>> First of all, thank you for the feedback.
> Thank you for the proposal - I'd love to see a few more functional parts =
like
> this in STL.
>
>> std::exception_ptr being the default type for E might not be a good
>> idea. Exceptions are a way to handle error but expected is another. The
> Well, integer error codes vs typed errors... I guess we could start a hol=
y war
> over this :)
IMHO, typed errors are only useful when there is contextual information=20
to report along with the error. Otherwise integer error codes do the job=20
well.
Exception are only a kind of "typed error" and I'd advise to use a=20
custom error structure (with virtual methods) over exceptions since we=20
cannot add virtual method to the existing std::exception type. Another=20
possibility would be to use a variant<E1, E2, ...> but it has the=20
inconvenient to change the signature if a new error is added.

Using exceptions when we don't need to interface with code using=20
exception is bad, it means we use the try-catch mechanism to go through=20
a hierarchy, this is not the goal of try-catch.
>
>> This is true, however in practice I suspect that users will use a type
>> definition on expected with their own error type:
>>
>> template <class T>
>> using expectation =3D expected<error_condition, T>;
>>
>> We get back our "happy path" :-)
> Yes, I guess that will become a new common idiom. Honestly, I'm not overl=
y
> happy about STL things needing a typedef/using to make them useful, but y=
es,
> this would be ok.
>
>> IMHO, we didn't use fancy names neither we invented any :-) map and bind
> I agree map/fmap/bind are already established names, but outside of C++. =
This
> remark was not aimed for this proposal per se, but more of a general worr=
y
> that we started introducing monads into C++ without predefining the commo=
n
> terminology.
>
>> Note that we add a syntax for a do-notation like in the section 7.1.
> Yes, saw that. That is one of the things I'd put in a separate proposal -=
 I'm
> guessing it will receive more resistance than just the expected<...> temp=
late.
I'm totally agree with you, this has little to do in the expected=20
proposal. We put it in because we wanted people to see aesthetic ways of=20
manipulating expected and monads in general.

Cheers,
Pierre

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

.
