220 34223 <2f48bdde-a6b6-473f-96ec-8836fd8de463@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Idea: Extension of structured bindings to
 definition of structs
Date: Wed, 30 Aug 2017 08:02:27 -0700 (PDT)
Lines: 113
Approved: news@gmane.org
Message-ID: <2f48bdde-a6b6-473f-96ec-8836fd8de463@isocpp.org>
References: <59dcbbbc-c536-4b7b-9c88-0638fb0cd58a@technion.ac.il>
 <7b9bf263-d3ca-42bf-aed6-4c7606782a28@isocpp.org>
 <1762295.OciJaA9sdk@tjmaciei-mobl1>
 <ff2ceb41-caca-4659-9a7d-4da9c2046810@isocpp.org>
 <74349bfe-bb5a-a2ce-4142-5d46103d1d9f@technion.ac.il>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_9631_16249119.1504105347654"
X-Trace: blaine.gmane.org 1504105389 21961 195.159.176.226 (30 Aug 2017 15:03:09 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 30 Aug 2017 15:03:09 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBBFHTPGQKGQEWDDCQXQ@isocpp.org Wed Aug 30 17:03:05 2017
Return-path: <std-proposals+bncBCEKFTV6ZUMBBBFHTPGQKGQEWDDCQXQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw0-f198.google.com ([209.85.161.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBBFHTPGQKGQEWDDCQXQ@isocpp.org>)
	id 1dn4Vf-0003ra-51
	for gclcip-std-proposals@m.gmane.org; Wed, 30 Aug 2017 17:02:27 +0200
Original-Received: by mail-yw0-f198.google.com with SMTP id i66sf29260586ywc.5
        for <gclcip-std-proposals@m.gmane.org>; Wed, 30 Aug 2017 08:02:30 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=5jvDQT73CkPHnPmoYuruy7HrHFQs3KdVRGo2A6f8OSM=;
        b=LRVg+O1aa5W4E0XUEUrW+1r6DjrvAW23Vdbzbop8AekICb7OoIcu5BBt8GutP9dfoB
         pvFKpsCGDNGat3s1z3sKLs59zxdphCSuSuYEysCnLEilFl61H52wegkZvRuaAcnUEtje
         qgToYsdsXVYg27qP9Ak/QsYdbCxWcbeqmzD+PCdCtVZE4PMa9kMg3O74JnruhCs0Prn/
         840x/8zvXBLi0A2pHAjk7DXOr2BD8dyb85XyyqKGHxV1MeNFsKM1KacfIOOTi8x8InKx
         M24d82IVBDNj0n6kpLrKkRiO+PB9gsgZbfzKgLL/JmWaaCgNB9pZDrBMWtS7oquzDnJY
         cP0g==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=5jvDQT73CkPHnPmoYuruy7HrHFQs3KdVRGo2A6f8OSM=;
        b=AcwNctBd4zcLgkXAXjPZbkbYeUoPZZe5nWqr09GoG0jFv6vEf2c3cL0VZ3NQPl6+hq
         2J4JtvVxtCaS7NYd07ezVPAxkz1B7cQF35voxbKkUhwS13AZ0bHvHbuFePI99WAaGtM7
         cUesgwhQucpIfsaW+8LkeYtbKQSvY+xZuyx+IIFNVVHog3gOK2RSg2iyjQR6CQfNU0ii
         eKjvIBEi5GjQhy8ayTwuY+aLtG7OFxVpZI1n3GdiSH+tRngS1/S2kHmMLVskVFcDuO9g
         gv+B38Hyp7XeB2xnYyXAuXa901MFSNiT9251EwZIMQHQTXPeIltnEPdFnfvr7ObIQBGw
         2Y4Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version: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=5jvDQT73CkPHnPmoYuruy7HrHFQs3KdVRGo2A6f8OSM=;
        b=pxNe3ZyIqhlQVuI6numjDOi2aoWT9WCU1dnwSJ+0JsR9OIaCNCEERw4pMrFlJuosMz
         FSs66pyCq37Y4k/oBUdOnBr99QBin7uSATS5D7eai38K5bVtIJttcLpfDKxnxCcppu6p
         J/C/VGFSt1qMAZzKS7smDAmM21akcWaKNR0aSm6EXu/4icHaQFYPHPYFOiIBVx9LnUyn
         VtiT+TVgZRPJE+bX8eTB4N+CD0UUKVP/4kx1i/AuzoCtTzVCLHxm1/jbjnVOd2yNseFY
         JzV9o4NAmCbGrNIBYmDE+CM4OZFjNea1G9wZih6EOi+M0mputseaN2tsTh5cUBMN8dHh
         BKUQ==
X-Gm-Message-State: AHYfb5gvlKfLKDGMjzMd+/xqeV32a4BfEWxDj7qBgZZgCKVnRIDoNdkO
	aMTdoKpRFCZLYYoa
X-Google-Smtp-Source: ADKCNb7uxqrBonaQdaxEGqGcGJgcg6vZGb/TKkvzJEZ+AftctVQsYaiiwu74SZvYGoSS8j1t2SxO5g==
X-Received: by 10.13.236.212 with SMTP id v203mr1162354ywe.58.1504105349888;
        Wed, 30 Aug 2017 08:02:29 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.183.212 with SMTP id h203ls4360128iof.24.gmail; Wed, 30
 Aug 2017 08:02:28 -0700 (PDT)
X-Received: by 10.31.155.132 with SMTP id d126mr20060vke.17.1504105348170;
        Wed, 30 Aug 2017 08:02:28 -0700 (PDT)
In-Reply-To: <74349bfe-bb5a-a2ce-4142-5d46103d1d9f@technion.ac.il>
X-Original-Sender: jmckesson@gmail.com
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:34223
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/34223>

------=_Part_9631_16249119.1504105347654
Content-Type: multipart/alternative; 
	boundary="----=_Part_9632_1848123028.1504105347654"

------=_Part_9632_1848123028.1504105347654
Content-Type: text/plain; charset="UTF-8"

On Wednesday, August 30, 2017 at 3:59:43 AM UTC-4, Eyal Rozenberg wrote:
>
> You would be using an unnamed struct for the same reason you use an 
> "unnamed type" for non-struct variables with auto. We write: 
>
>   auto x = expr; 
>
> although we could write 
>
>   using whatever_t = decltype(expr); 
>
>   // ... 
>
>   whatever_t x = expr; 
>
> except we do it for several values which are grouped together in a 
> struct.


But the reason I'm using `auto` is because I either:

1) Don't need to write the name of the type, since it is obvious by 
inspection
2) Do not want to write the name of the type, since it's long, complex, etc

Why do I need to create a *type* that contains a bunch of such variables? 
And why would I need to do it *inline* like this?

If I'm creating a collection of values, then that collection generally has 
some meaning to the program. There are probably several functions that take 
it as parameters, or there are member functions that operate on it, or 
whatever.

So what is the point of having this unnamed struct that uses 
automatically-deduced values? Who am I going to pass it to? What operations 
am I going to perform on it? Why did I make a struct out of it instead of 
just having a number of loose variables?

The second option does the exact same thing, but it's annoying 
> and verbose.
>

-- 
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 email 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/2f48bdde-a6b6-473f-96ec-8836fd8de463%40isocpp.org.

------=_Part_9632_1848123028.1504105347654
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Wednesday, August 30, 2017 at 3:59:43 AM UTC-4, Eyal Ro=
zenberg wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-l=
eft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">You would be usi=
ng an unnamed struct for the same reason you use an
<br>&quot;unnamed type&quot; for non-struct variables with auto. We write:
<br>
<br>=C2=A0 auto x =3D expr;
<br>
<br>although we could write
<br>
<br>=C2=A0 using whatever_t =3D decltype(expr);
<br>
<br>=C2=A0 // ...
<br>
<br>=C2=A0 whatever_t x =3D expr;
<br>
<br>except we do it for several values which are grouped together in a
<br>struct.</blockquote><div><br>But the reason I&#39;m using `auto` is bec=
ause I either:<br><br>1) Don&#39;t need to write the name of the type, sinc=
e it is obvious by inspection<br>2) Do not want to write the name of the ty=
pe, since it&#39;s long, complex, etc<br><br>Why do I need to create a <i>t=
ype</i> that contains a bunch of such variables? And why would I need to do=
 it <i>inline</i> like this?<br><br>If I&#39;m creating a collection of val=
ues, then that collection generally has some meaning to the program. There =
are probably several functions that take it as parameters, or there are mem=
ber functions that operate on it, or whatever.<br><br>So what is the point =
of having this unnamed struct that uses automatically-deduced values? Who a=
m I going to pass it to? What operations am I going to perform on it? Why d=
id I make a struct out of it instead of just having a number of loose varia=
bles?<br><br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0;mar=
gin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">The second =
option does the exact same thing, but it&#39;s annoying
<br>and verbose.<br></blockquote></div>

<p></p>

-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/2f48bdde-a6b6-473f-96ec-8836fd8de463%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/2f48bdde-a6b6-473f-96ec-8836fd8de463=
%40isocpp.org</a>.<br />

------=_Part_9632_1848123028.1504105347654--

------=_Part_9631_16249119.1504105347654--

.
