220 20917 <3a1c9a29-3c55-403c-9d94-1504eabc8e44@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Vincent Picaud <picaud.vincent@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Introducing the returntype keyword
Date: Mon, 28 Sep 2015 06:01:56 -0700 (PDT)
Lines: 118
Approved: news@gmane.org
Message-ID: <3a1c9a29-3c55-403c-9d94-1504eabc8e44@isocpp.org>
References: <24e315aa-2daf-4e47-933b-1f45157a0f79@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_2223_1287738834.1443445317043"
X-Trace: ger.gmane.org 1443445321 10728 80.91.229.3 (28 Sep 2015 13:02:01 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 28 Sep 2015 13:02:01 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDTIFJOFQUJBBRXUUSYAKGQE6Z2WROA@isocpp.org Mon Sep 28 15:02:01 2015
Return-path: <std-proposals+bncBDTIFJOFQUJBBRXUUSYAKGQE6Z2WROA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qg0-f72.google.com ([209.85.192.72])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDTIFJOFQUJBBRXUUSYAKGQE6Z2WROA@isocpp.org>)
	id 1ZgY48-00005R-F5
	for gclcip-std-proposals@m.gmane.org; Mon, 28 Sep 2015 15:02:00 +0200
Original-Received: by qgez77 with SMTP id z77sf185617094qge.2
        for <gclcip-std-proposals@m.gmane.org>; Mon, 28 Sep 2015 06:01:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :content-type:x-original-sender:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=DxDaXHR2xbK6DE1OemofdfVE4Po3hGkehwFhtdXxdlw=;
        b=EHh/QDn1QrWMhnIV9dXBMGGkJOklkAytGCTxlizF05XiYXTXEJ8UDRTBF9hiLKZMO0
         IjEhMHhF2+vRAzGKrrLvniB7A8hTEkXProvNctMF0I9IddraBqSGHxtF6JUmaAA25bpt
         hzZSGf8sDp0cdP8yxhq9YWSfWITQNydeoXc1GlokbpGfV6xuH1D+TeRMcWMP/VFTzqML
         ang2wFvuHgKZ2r9tf1lmSC4iwQ4xY7H98UR0b414lCeF7rbOYoZ9iKVCqkx2etewIn2I
         62ifnhfebNjcORu8PW0QwYCK81dItJcfNUkUxP3tCuEmAITBNOXgYjD9UsyYng6p2Lj/
         jKVg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:content-type:x-original-sender:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=DxDaXHR2xbK6DE1OemofdfVE4Po3hGkehwFhtdXxdlw=;
        b=PGco1aHVoMZcbsYFsBPjKN/njwqavDK1ut6oN3UWRojRe5GComOWOW/kJPRUoiWcaJ
         NHTC9peudbeVQ9d4fcOFkCXkyUQZuNbSGKqoNkYGMU16WbTzrZwTk+7q3O4eB6NO+8hE
         ylSbiv7tb5da3g4nfGIOgp+6EtloYL/aX1Au2G8v661pIud6jsvTcSV6ohPSNzDvdq7j
         zQVMqfU6K/WIKDmit/LoyyDQGz0pCiGYvYY9DTmm2n/PNxjNMjRVpUSVTOofVtwE4mnL
         tABwiWacDZlGUp37yxVU7JMP+AoMKUW2mgI7BdrIkQg3BIlnU9XI5y0lAPVhYm1rg/K8
         lrKA==
X-Gm-Message-State: ALoCoQm+NsYC5XwX76qbDTd0RwIAG8tAJ73cuBZRq0dYYrIv4zOrT+ZvOW6iMXmNlhhQ7zNZCXI1
X-Received: by 10.31.16.79 with SMTP id g76mr18201455vki.10.1443445319074;
        Mon, 28 Sep 2015 06:01:59 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.12.204 with SMTP id 73ls1708012iom.31.gmail; Mon, 28 Sep
 2015 06:01:58 -0700 (PDT)
X-Received: by 10.50.28.19 with SMTP id x19mr142179igg.16.1443445318090;
        Mon, 28 Sep 2015 06:01:58 -0700 (PDT)
In-Reply-To: <24e315aa-2daf-4e47-933b-1f45157a0f79@isocpp.org>
X-Original-Sender: picaud.vincent@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: 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: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:20917
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/20917>

------=_Part_2223_1287738834.1443445317043
Content-Type: multipart/alternative; 
	boundary="----=_Part_2224_813007833.1443445317043"

------=_Part_2224_813007833.1443445317043
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I do agree with Mikhail Semenov, a* returntype* keyword would be nice

Note that:
SomeType foo(SomeArgTypes... someArgs)
{
decltype(foo(someArgs)) toReturn;
.....
return toReturn;
}

is only a partial and error prone solution, as you have to modify=20
"SomeArgs" two times:
 - function prototype
 - decltype(...)
if you have to modify foo arguments.

Le mercredi 23 septembre 2015 21:32:48 UTC+2, Mikhail Semenov a =C3=A9crit =
:
>
> I propose to introduce the *returntype *keyword, which will represent the=
=20
> return type of the current function.
>
> The aim is=20
> (1) to define a local variable, which will be used to return the value of=
=20
> the function.
> (2) to convert an expression to the value of the return type.
>
> In practice, it is convenient to use when you want to change the return=
=20
> type without restructuring the whole function body.
>
> struct Type2 { explicit Type2(int){} };
>
> Type2 f2_braces()=20
> {
>     returntype local2{2}; // ok
>     return local2; //
>
>     ...
>     return returntype{10}; // ok
> }
>
> If I want to change Type2 to Type3 I need only to change the function=20
> header without touching the body.
>
>
>
>

--=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/.

------=_Part_2224_813007833.1443445317043
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I do agree with <span class=3D"_username"><span style=3D"c=
olor: rgb(34, 34, 34);" class=3D"CMTFO4B-N-a">Mikhail Semenov</span></span>=
, a<b> returntype</b> keyword would be nice<br><br>Note that:<br>SomeType f=
oo(SomeArgTypes... someArgs)<br>{<br>decltype(foo(someArgs)) toReturn;<br>.=
....<br>return toReturn;<br>}<br><br>is only a partial and error prone solut=
ion, as you have to modify &quot;SomeArgs&quot; two times:<br>=C2=A0- funct=
ion prototype<br>=C2=A0- decltype(...)<br>if you have to modify foo argumen=
ts.<br><br>Le mercredi 23 septembre 2015 21:32:48 UTC+2, Mikhail Semenov a =
=C3=A9crit=C2=A0:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"l=
tr"><div>I propose to introduce the <b>returntype </b>keyword, which will r=
epresent the return type of the current function.</div><div><br></div><div>=
The aim is </div><div>(1) to define a local variable, which will be used to=
 return the value of the function.</div><div>(2) to convert an expression t=
o the value of the return type.</div><div><br></div><div>In practice, it is=
 convenient to use when you want to change the return type without restruct=
uring the whole function body.</div><div><br></div><div>struct Type2 { expl=
icit Type2(int){} };<br></div><div><br></div><div>Type2 f2_braces() <br>{<b=
r>=C2=A0=C2=A0=C2=A0 returntype local2{2}; // ok</div><div>=C2=A0=C2=A0=C2=
=A0 return local2; //</div><div><br></div><div>=C2=A0=C2=A0=C2=A0 ...<br>=
=C2=A0=C2=A0=C2=A0 return returntype{10}; // ok<br>}</div><div><br></div><d=
iv>If I want to change Type2 to Type3 I need only to change the function he=
ader without touching the body.</div><div><br></div><div><br></div><div><br=
></div></div></blockquote></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_2224_813007833.1443445317043--
------=_Part_2223_1287738834.1443445317043--

.
