220 21056 <muha7l$e1n$1@ger.gmane.org> article
Path: news.gmane.org!not-for-mail
From: Matthew Woehlke <mwoehlke.floss@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Introducing the returntype keyword
Date: Wed, 30 Sep 2015 14:38:44 -0400
Lines: 65
Approved: news@gmane.org
Message-ID: <muha7l$e1n$1@ger.gmane.org>
References: <24e315aa-2daf-4e47-933b-1f45157a0f79@isocpp.org> <3a1c9a29-3c55-403c-9d94-1504eabc8e44@isocpp.org> <f73f73f8-8c2f-4d99-888b-ed688daff8b8@isocpp.org> <0c43e09d-a5a9-4c35-8db7-0ff0a77f81d1@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Trace: ger.gmane.org 1443638350 18015 80.91.229.3 (30 Sep 2015 18:39:10 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 30 Sep 2015 18:39:10 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC37LBFWUIFBBQ6YWCYAKGQEPBIXRRQ@isocpp.org Wed Sep 30 20:39:02 2015
Return-path: <std-proposals+bncBC37LBFWUIFBBQ6YWCYAKGQEPBIXRRQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-la0-f71.google.com ([209.85.215.71])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBC37LBFWUIFBBQ6YWCYAKGQEPBIXRRQ@isocpp.org>)
	id 1ZhMHN-000519-9S
	for gclcip-std-proposals@m.gmane.org; Wed, 30 Sep 2015 20:39:01 +0200
Original-Received: by laer8 with SMTP id r8sf26554017lae.2
        for <gclcip-std-proposals@m.gmane.org>; Wed, 30 Sep 2015 11:39:00 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:to:from:subject:date:lines:message-id:references
         :mime-version:content-type:content-transfer-encoding:user-agent
         :in-reply-to:x-original-sender:x-original-authentication-results
         :reply-to:precedence:mailing-list:list-id:x-spam-checked-in-group
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=64459mDDwWxKlWfKddEcHizwWsm0WUUAp/pMebOULI4=;
        b=Zm13F6f3ZzfZGG8H6ypxRtvBfA1SQvp3CP2cwaEzyjUbyeYksHiczG2YlmzJ0VLswb
         +uCB29c+AfTRXD7Ea0OpB2CXQfHT4kGLjoo0wSXw286b3UXEclyfOF1JA8eX219yTUNi
         4GYi0nvvfby5gdpnO5YU9ONWIFiRja+bd85gb5Et1EWsWvdYrMBFfGRy+wTNm9/nEB5n
         1m1KAzYP8Fiv0sFF6wO73xB9plUe92ak47DDuUIAloR+FciVdOTegafHZY8dB1ROVjvT
         wSIBxp5wwPaGrPvBdOEe+6E2gDhqGWlQerfU6h/AzKyOvV3HCI9 
X-Gm-Message-State: ALoCoQn8Q1+NIwpNhZXyvhZdF3quiDHEB5/qpYLadgVEHbH8rpgTP6qu3onFUEGkkDVN4wR6gt8N
X-Received: by 10.180.12.170 with SMTP id z10mr904607wib.1.1443638340353;
        Wed, 30 Sep 2015 11:39:00 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.152.9.69 with SMTP id x5ls72978laa.30.gmail; Wed, 30 Sep 2015
 11:38:59 -0700 (PDT)
X-Received: by 10.112.171.69 with SMTP id as5mr1548512lbc.111.1443638339114;
        Wed, 30 Sep 2015 11:38:59 -0700 (PDT)
Original-Received: from plane.gmane.org (plane.gmane.org. [80.91.229.3])
        by mx.google.com with ESMTPS id p72si837448lfp.112.2015.09.30.11.38.59
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=RC4-SHA bits=128/128);
        Wed, 30 Sep 2015 11:38:59 -0700 (PDT)
Received-SPF: pass (google.com: domain of gclcip-std-proposals@m.gmane.org designates 80.91.229.3 as permitted sender) client-ip=80.91.229.3;
Original-Received: from list by plane.gmane.org with local (Exim 4.69)
	(envelope-from <gclcip-std-proposals@m.gmane.org>)
	id 1ZhMHI-0004y7-Rv
	for std-proposals@isocpp.org; Wed, 30 Sep 2015 20:38:57 +0200
Original-Received: from tripoint.kitware.com ([66.194.253.20])
        by main.gmane.org with esmtp (Gmexim 0.1 (Debian))
        id 1AlnuQ-0007hv-00
        for <std-proposals@isocpp.org>; Wed, 30 Sep 2015 20:38:56 +0200
Original-Received: from mwoehlke.floss by tripoint.kitware.com with local (Gmexim 0.1 (Debian))
        id 1AlnuQ-0007hv-00
        for <std-proposals@isocpp.org>; Wed, 30 Sep 2015 20:38:56 +0200
X-Injected-Via-Gmane: http://gmane.org/
Original-Lines: 47
Original-X-Complaints-To: usenet@ger.gmane.org
X-Gmane-NNTP-Posting-Host: tripoint.kitware.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
In-Reply-To: <0c43e09d-a5a9-4c35-8db7-0ff0a77f81d1@isocpp.org>
X-Original-Sender: mwoehlke.floss@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of gclcip-std-proposals@m.gmane.org designates 80.91.229.3 as
 permitted sender) smtp.mailfrom=gclcip-std-proposals@m.gmane.org;
       dmarc=fail (p=NONE dis=NONE) header.from=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:21056
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/21056>

On 2015-09-29 00:01, Nicol Bolas wrote:
> On Monday, September 28, 2015 at 11:01:21 PM UTC-4, Arthur O'Dwyer wrote:
>> In other words, the cost of this feature is high;
>=20
> No, the cost of this feature is actually quite low. As others have pointe=
d=20
> out, you could spell it `decltype(return)`, so you don't have the cost of=
=20
> an actual keyword.
>=20
> Even in implementation time, I can't imagine that this feature would=20
> require much effort on the part of compiler writers.

....*if* it's an error to use it before the return type is known. Not
that I consider that as a problem; just being pedantic :-).

>> Also =E2=80=94 this isn't a killer, but =E2=80=94 it seems awkward to ha=
ve *both* "parse=20
>> the body of the function to deduce the auto return type" *and* "while=20
>> parsing the body of a function, replace decltype(return) with the return=
=20
>> type of the function" in the same language.

The example where the type is not known but is early deduced is
interesting in that respect; it's conceivable that you would indeed want
to use both features in the same function.

> This also made me realize that, outside of TMP or constexpr shenanigans, =
I=20
> don't remember the last time I used direct "call myself"-style recursion.=
=20

....quicksort? ;-) (I don't mean that you personally have written a
quicksort recently, just that there *are* reasonable cases for functions
that call themselves.)

Actually, I just wrote one the other day that checks for a certain error
initially and resorts to a default behavior in such case. Later, other
operations that fail can self-call with intentionally bad arguments to
get back to the default-behavior case. Sure, I could structured it
differently to avoid that (or use goto)... just saying, it's one case I
actually have - recently - written a function that directly calls itself.

I could imagine in the case of functions with a trampoline header that
being able to name itself would be useful. (Meaning, for example, a
function that, at the start of execution and based on some condition,
either modifies its arguments and reinvokes itself, or schedules itself
to be called again at a later time or in a different context, and then
(usually) immediately exits without doing anything further. This is a
fairly common pattern in some multi-threaded designs.)

--=20
Matthew

--=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/.

.
