220 30002 <1634996.i8lsGMFXel@tjmaciei-mobl1> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Thiago Macieira <thiago@macieira.org>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Return type deduction into a template parameter
Date: Sat, 24 Dec 2016 14:15:32 -0200
Lines: 79
Approved: news@gmane.org
Message-ID: <1634996.i8lsGMFXel@tjmaciei-mobl1>
References: <25614213-fc89-43e3-a17d-228fe01a9d01@isocpp.org> <2def9f74-1a39-405c-8ae3-87336d646ee2@isocpp.org> <3490b351-9080-4fa1-af35-f43cb315d278@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Trace: blaine.gmane.org 1482596155 30331 195.159.176.226 (24 Dec 2016 16:15:55 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sat, 24 Dec 2016 16:15:55 +0000 (UTC)
User-Agent: KMail/5.3.3 (Linux/4.8.13-1-default; KDE/5.28.0; x86_64; ; )
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCB4TK757YBRBON67LBAKGQERE3362Q@isocpp.org Sat Dec 24 17:15:49 2016
Return-path: <std-proposals+bncBCB4TK757YBRBON67LBAKGQERE3362Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lf0-f69.google.com ([209.85.215.69])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCB4TK757YBRBON67LBAKGQERE3362Q@isocpp.org>)
	id 1cKoz7-00078S-6s
	for gclcip-std-proposals@m.gmane.org; Sat, 24 Dec 2016 17:15:49 +0100
Original-Received: by mail-lf0-f69.google.com with SMTP id d16sf40638533lfb.7
        for <gclcip-std-proposals@m.gmane.org>; Sat, 24 Dec 2016 08:15:54 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=from:to:subject:date:message-id:user-agent:in-reply-to:references
         :mime-version:content-transfer-encoding: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=wBxODR/Dsf0xBVT2LrBLnMdntwGHW5KowzJaGubTik4=;
        b=Gu2OCcDeTFTV3LqXDNrn/YX0fv7+WVlnCCrPryaL/8jGFFIwbiT29R73tP7fgtdP4y
         R0J0G9ic/scxOnBq8d+aZvJ4LLJMF5RkuueGNTZM72tRIGFqMdW1qTlxoBnLsq06fxX9
         Pd0OKChePCHE9iLWUMlPqCQFZAaUM3osKw1wMVpKOTLvP42Zv/NTCnIjeXm0dL70sgg0
         vUmiCvSjNwnLRFB40LrTCSEkyYRe3QgWsvQKl1UuLKw0dz8F+YvKCPW5+QQppCKcFXEA
         i9GO3plwESxqq9HltqFcxUoGTq7fs/hrMFPECb4I+59GJgAO38LDw8V0/WwdyJYE2K51
      
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:from:to:subject:date:message-id:user-agent
         :in-reply-to:references:mime-version:content-transfer-encoding
         :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=wBxODR/Dsf0xBVT2LrBLnMdntwGHW5KowzJaGubTik4=;
        b=AF9HH5gdQaHOj/u5r3CjAbta5+pEtFkpu4FIdpUzRr+7+17cY9MlSp+8yzEX6LyyIH
         DjfWipbQm2bD45IUAA6d9tP+dItV2wq8/ckFYxI6hpq5uvSR5qyuZjV9obKz9/x8B7Lt
         km/qHRl11Z2O/OIWpU6pA90eiBUKqqOkvcyihraWgaNZeSqJH+S9ejMo6v3su8hyDD/3
         ZhpZKiN4rK9F2ECcjbSECsPVspJmL4eaf3hUuWrCgxx0/FjByOkk9Ze0YTxnFZCsIW90
         DIxy3Ui2PMVRTd4EGf1byjJnIWbEbBhRk7U29Nte4Bb3+xfqJJeu9BMuWozswJJ2aWnR
  
X-Gm-Message-State: AIkVDXKPBPYFBgJYRu51oIYvFfE5qg3cbpet1/WUkq4tWqABMCr6VCF911ykBfGhCBzTdg==
X-Received: by 10.46.33.214 with SMTP id h83mr2101955lji.24.1482596154034;
        Sat, 24 Dec 2016 08:15:54 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.47.204 with SMTP id v195ls3155061wmv.3.gmail; Sat, 24 Dec
 2016 08:15:52 -0800 (PST)
X-Received: by 10.194.246.170 with SMTP id xx10mr17815150wjc.174.1482596152655;
        Sat, 24 Dec 2016 08:15:52 -0800 (PST)
Original-Received: from gondolin.macieira.info (gondolin.macieira.info. [2a01:4f8:d13:f81:21c:14ff:fe01:12a3])
        by mx.google.com with ESMTP id qj8si39734011wjb.165.2016.12.24.08.15.52
        for <std-proposals@isocpp.org>;
        Sat, 24 Dec 2016 08:15:52 -0800 (PST)
Received-SPF: pass (google.com: domain of thiago@macieira.org designates 2a01:4f8:d13:f81:21c:14ff:fe01:12a3 as permitted sender) client-ip=2a01:4f8:d13:f81:21c:14ff:fe01:12a3;
Original-Received: from tjmaciei-mobl1.localnet (unknown [189.110.133.253])
	by gondolin.macieira.info (Postfix) with ESMTPSA id 08A2911B5D9
	for <std-proposals@isocpp.org>; Sat, 24 Dec 2016 08:15:35 -0800 (PST)
In-Reply-To: <3490b351-9080-4fa1-af35-f43cb315d278@isocpp.org>
X-Original-Sender: thiago@macieira.org
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of thiago@macieira.org designates 2a01:4f8:d13:f81:21c:14ff:fe01:12a3
 as permitted sender) smtp.mailfrom=thiago@macieira.org
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: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://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>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:30002
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/30002>

Em s=C3=A1bado, 24 de dezembro de 2016, =C3=A0s 07:50:23 BRST, aary@umich.e=
du escreveu:
> That still requires the user to read the code and find the return
> statement, further the situation is complicated when the function is the
> last one in a chain of functions that return a value, in which case the
> user has to trace the return statements all the way to the first function
> that returned the actual type.  Or alternatively use an IDE.  But having
> this there still means that the language syntax is more clear to the
> reader.

If the user has to trace something, then the API is badly designed. Don't=
=20
change the language to correct an API design flaw. Just design the API in a=
=20
better way.

Or, alternatively, make it so the user doesn't have to read the function an=
d=20
doesn't need to know what the actual type is. It's perfectly fine to have=
=20
complex or automatically-deduced return types that aren't evident. The user=
=20
will use auto too and that's that.

The user will never store that in a member or global variable. That's all.

> What I meant to say was that the object returned would be an an object of
> an instantiation of the class template with the type of the return
> parameter.  I could not figure out how to edit my post :(.  For instance =
if
> you consider the following code
>=20
> template <typename Type>
> class Interface {
>     Interface(Type&& object_in) : object{std::forward<Type>(object_in) {}
>     Type object;
> };
>=20
> class Something {
> public:
>     using value_type =3D int;
> };
>=20
> Interface<auto> return_something(const Something& something) {
>     return something::value_type{1};
> }

<auto> is already in use by Concepts. Is your proposal aligned with that?

If not, please find a different syntax.

> This would return an Interface object with the integer 1 as a member

It would return an Interfact<int> object.

> variable.  I do not know whether this idea already exists built I thought
> this feature could be more flexible than just a concept, as it allows the
> usage of templates with the automatic return type deduction (which is an
> awesome idea), and does not require the use of trailing return types (whi=
ch
> are verbose and sometimes not required).

Please take a look at Concepts Lite. It may solve what you're looking for. =
Or=20
it may be a conflicting use of the syntax.

--=20
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/1634996.i8lsGMFXel%40tjmaciei-mobl1.

.
