220 34287 <f9ccebb4-6704-167c-5f1e-b0f58794a15d@technion.ac.il> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Eyal Rozenberg <eyalroz@technion.ac.il>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Idea: Extension of structured bindings to
 definition of structs
Date: Mon, 4 Sep 2017 16:16:35 +0200
Lines: 75
Approved: news@gmane.org
Message-ID: <f9ccebb4-6704-167c-5f1e-b0f58794a15d@technion.ac.il>
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>
 <CAGg_6+MPQTnqdWLQ1UV8jF173jDXYQQx-abwwNV3v3iknocJ=Q@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Trace: blaine.gmane.org 1504534624 15686 195.159.176.226 (4 Sep 2017 14:17:04 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 4 Sep 2017 14:17:04 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:56.0) Gecko/20100101
 Thunderbird/56.0
To: std-proposals@isocpp.org, Nevin Liber <nevin@eviloverlord.com>
Original-X-From: std-proposals+bncBDHKZN7LR4ARBTOAWXGQKGQE2YE4M3Q@isocpp.org Mon Sep 04 16:16:44 2017
Return-path: <std-proposals+bncBDHKZN7LR4ARBTOAWXGQKGQE2YE4M3Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wr0-f200.google.com ([209.85.128.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDHKZN7LR4ARBTOAWXGQKGQE2YE4M3Q@isocpp.org>)
	id 1dosB5-00034E-PP
	for gclcip-std-proposals@m.gmane.org; Mon, 04 Sep 2017 16:16:39 +0200
Original-Received: by mail-wr0-f200.google.com with SMTP id b43sf145036wrg.5
        for <gclcip-std-proposals@m.gmane.org>; Mon, 04 Sep 2017 07:16:47 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1504534606; cv=pass;
        d=google.com; s=arc-20160816;
        b=VDjWVs1CflBJqkEEUJ9j8zGg/9OyopY261dNZgblwjhgRWe2CVcy0uU8vXklulCt4B
         HChQlXBZQHh9RFZQlyD2ZW1SVUHiK3bHPdliyRABxqY9t9IQVA8XbQpExiApAQ6eDq0/
         efd8jPYkJcpwikJuI8DlNp8aTtTx3+dA8SCd54iJLG0SExgFkQGO1fldy9dyt4Zxpfrr
         cFtGXJ/fMh6M8NYumfnIStNGnFS6VfgjOWYyCkoR/2itl3Q310BCYJsuJtnEtcLHXSSS
         oOkkImV1CJqXdZ2jvG35GkkaHoCCxmIO4O+18J3Fy/UUnz4HB/DLHo84GmWYNvjcT8hv
         AHEg==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:content-transfer-encoding
         :content-language:in-reply-to:mime-version:user-agent:date
         :message-id:from:references:to:subject:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=dj5p5LWjQErJkGO6lHoam2Osagf59IHHnJT2nbxw3uM=;
        b=Lp1XOwvKeJA0fLaAcp3R70egnAnQfdwiAdPKdydaZeur/DOnS5TBOhQk7zTcm7j11T
         AVmw2tI3Ix2QMRboy4QBSC2Ct8WwtTwu7fBBqda9zB9U/gHas3moL1I6JfIZKYQU9r25
         raKNgu95y7N+xBx23QLohJO7T7mu81lTIaZvs3fl8Ifw+KhhmPAaRR79pkLPn+x6rXsO
         kp/K5bhTeNJtSPn8jAqFsD4UvCN2W8DQHKKTdel5csAJgbg1Pf2HRLOCUQo8Okj+Uz3F
         4T/OFVd7sCEhok8lo6avYObyHkdBn3lSLRWIiBrk2+aVqtuvZGLijIC1wMhJQp 
ARC-Authentication-Results: i=2; mx.google.com;
       spf=pass (google.com: domain of srs0=5sp6a=af=technion.ac.il=eyalroz@cwi.nl designates 192.16.191.27 as permitted sender) smtp.mailfrom=SRS0=5SP6A=AF=technion.ac.il=eyalroz@cwi.nl
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=subject:to:references:from:message-id:date:user-agent:mime-version
         :in-reply-to:content-language:content-transfer-encoding
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=dj5p5LWjQErJkGO6lHoam2Osagf59IHHnJT2nbxw3uM=;
        b=a8tEsxaWA+PWSEILiF0nO650oL68yLg16irv7uuZ+IPVG4cCRjX1/N2VaCxorYxuxJ
         5RirdkYCxQUcYXadpU/n5k00IEktdOc6Lz5SIaqPIcTjXo7WX/KB9o8H6NVARLkmskjb
         zp4rSajlFmRmbuamTfQNuwIoKe1ng/PHK1rZUnt7PrEgRisknSdfbQNUdzdH6QJ5xJa8
         rAh9e0657uaMyOsX3audCZ4IxBhZlr8fKJ6FgNYrqeuZyrHcUycFoOM/GwPXxDkqlgnW
         lSNEt7rAEmnTvEm8UJlx4dxFdWSPAWsfXZFZNNbFcAltigt4WoTONFHDZm8eKYRQ4Dhl
         tuD 
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-language
         :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=dj5p5LWjQErJkGO6lHoam2Osagf59IHHnJT2nbxw3uM=;
        b=aNBfWbPy8Zc6HRUE3BPXaqgfYTlVM4KIkGdEbbhDjTrimOEwsf4cKLab0e60RSkxXV
         7v2pZ/Kl+b5WfV7fvrNpNLEANOiOYjLEza5OnY5VwNPKPE+ipClvetu7vXNSwuRKSp9A
         +FQzHRJNjmNWccuMBa3p0wXxIwLLvnkxa9UxeZnXJB4/SG4A5wQHeBnMuHnH3qWh48NK
         ywJneJQpMIVOW6WFEwttqMp6897F/bOsog4ddsIg5WFZpl10zmKdeAmeW/NbIb53UtKT
         verfEcpIz87+HB8/QQPnhbgqqDoM15XxCOK68ByNImb 
X-Gm-Message-State: AHPjjUiW52z8zrHovhjmi1YMpdGMIApL3q8cokYRXn5m9QnzGVw+w7zY
	0Usrci8gzytPZQ==
X-Google-Smtp-Source: ADKCNb7O1+Nbx3YqRznR8HcpNMJyiKjlXsWs606LNGB3FoisSgq4noZaYv82Uh32Y8kSbN8vHN0KEg==
X-Received: by 10.28.21.65 with SMTP id 62mr80068wmv.22.1504534606553;
        Mon, 04 Sep 2017 07:16:46 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.178.75 with SMTP id b72ls1363472wmf.27.canary-gmail; Mon,
 04 Sep 2017 07:16:44 -0700 (PDT)
X-Received: by 10.80.174.176 with SMTP id e45mr650468edd.122.1504534604807;
        Mon, 04 Sep 2017 07:16:44 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1504534604; cv=none;
        d=google.com; s=arc-20160816;
        b=bUFJOhvT00NT+nf7Qtb9OD2yFVIJdMAoGRC8SfBpo6zuLzwO4UxzKURPV8hhlVom8g
         Q74+T2eRkBpfXxQ1lOfPoCVKsW9+UJ7X9g4MuEMo7r1SYd6LFAZZgfUNQ7eUijKRibZq
         SfimHHkksXFzX16Xm5uLGaHWwwvxjy8x+mrZ6bnlXMChT67zTEyavc1lBZpTjTVbmzeW
         rF4941Rz8rPfTXt/l2i9jowVnePK+kv/qWK0TBom3/B49my1W4xWAO+jeQH5nHvKai3T
         gNl1nrwjts8q2fmH/PkQgFISyMoFY/XdoBkeGtAOr0a7Le0vdxM8AaKuEbviPQcB3OW8
         hs4A==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-transfer-encoding:content-language:in-reply-to:mime-version
         :user-agent:date:message-id:from:references:to:subject
         :arc-authentication-results;
        bh=1y7mGiAeDdH5YcD4erA6R18H4dXov3d1OgrP1f++44Q=;
        b=B6fsp404R3gS8TP1/Xb++tUfRzLux/T4dRUFYQIB3IjcpAQRGywI32hsItQmuNDYUH
         zU12Ji/xwtvHyqyn+jT02KYBu8jCcimL9B3y6L2oX6tFoFaushYDkrGWiyv3eClBiYZs
         hOTmp6/0AnqlhV0RDsiGFbvDHlFxU6+hNoUCDKXsd9U9JX7vWQb6mjnCdrFtrgWbVvpz
         mzb8j+d5WSsCmGD7ojy+da5Xs9kiqU8Apjz07SRvt1+q0qauaZMoO/ADzWsI7hRIy+vQ
         xV1t3JxVreJMGH1QsqiFELbBk9kDAjKvUF6BM0nFwPSPXgXqJ77gUA3GIiOZAvQmR9lS
         Dd9Q==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=pass (google.com: domain of srs0=5sp6a=af=technion.ac.il=eyalroz@cwi.nl designates 192.16.191.27 as permitted sender) smtp.mailfrom=SRS0=5SP6A=AF=technion.ac.il=eyalroz@cwi.nl
Original-Received: from fester.cwi.nl (fester.cwi.nl. [192.16.191.27])
        by mx.google.com with ESMTPS id u12si7441603edk.405.2017.09.04.07.16.44
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Mon, 04 Sep 2017 07:16:44 -0700 (PDT)
Received-SPF: pass (google.com: domain of srs0=5sp6a=af=technion.ac.il=eyalroz@cwi.nl designates 192.16.191.27 as permitted sender) client-ip=192.16.191.27;
Original-Received: from fester.cwi.nl (fester.cwi.nl [192.16.191.27])
	by fester.cwi.nl (8.14.4/8.12.3) with ESMTP id v84EGf7X013762;
	Mon, 4 Sep 2017 16:16:41 +0200
Original-Received: from [192.168.2.1] (ip565d4370.direct-adsl.nl [86.93.67.112] (may be forged))
	(authenticated bits=0)
	by fester.cwi.nl (8.14.4/8.12.3) with ESMTP id v84EGeDP013755
	(version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO);
	Mon, 4 Sep 2017 16:16:41 +0200
In-Reply-To: <CAGg_6+MPQTnqdWLQ1UV8jF173jDXYQQx-abwwNV3v3iknocJ=Q@mail.gmail.com>
Content-Language: en-US
X-Original-Sender: eyalroz@technion.ac.il
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of srs0=5sp6a=af=technion.ac.il=eyalroz@cwi.nl designates
 192.16.191.27 as permitted sender) smtp.mailfrom=SRS0=5SP6A=AF=technion.ac.il=eyalroz@cwi.nl
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:34287
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/34287>

I'm not actually suggesting a new way to create a type. The type is=20
created anyway if I write:

   struct {
       decltype(std::get<0>(get_car_parts())) engine;
       decltype(std::get<0>(get_car_parts())) dashboard;
       decltype(std::get<0>(get_car_parts())) stickshift;
   } car_parts =3D get_car_parts();

I'm just suggesting some syntactic sugar for that statement:

   struct { auto engine, dashboard, stickshift; } car_parts =3D
       get_car_parts();

A third alternative is not to create a type and write:

   auto [ car_engine, car_dashboard, car_stickshift ] =3D get_car_parts();

but I (we?) should frown upon this use of prefixes in identifiers.

As Larry Evans suggest, this scenario occasionally happens, so we're not=20
talking about an esoteric use-case.

Eyal

On 8/30/17 5:16 PM, Nevin Liber wrote:
> On Wed, Aug 30, 2017 at 2:59 AM, Eyal Rozenberg <eyalroz@technion.ac.il=
=20
> <mailto:eyalroz@technion.ac.il>> wrote:
>=20
>     You would be using an unnamed struct for the same reason you use an
>     "unnamed type" for non-struct variables with auto. We write:
>=20
>      =C2=A0 auto x =3D expr;
>=20
>=20
> Even though you don't spell it out, that type already has a name. =C2=A0a=
uto=20
> doesn't create a new type.
>=20
> You are proposing yet another syntax to create a new type.=C2=A0 As for i=
ts=20
> use, about the only thing you can do with it is pass it to a template=20
> function (or equivalent).=C2=A0 That use seems fairly marginal.=C2=A0 You=
 need=20
> much better usage examples for motivation.
> --=20
>  =C2=A0Nevin ":-)" Liber=C2=A0 <mailto:nevin@eviloverlord.com=20
> <mailto:nevin@eviloverlord.com>> =C2=A0+1-847-691-1404
>=20
> --=20
> You received this message because you are subscribed to the Google=20
> Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send=20
> an email to std-proposals+unsubscribe@isocpp.org=20
> <mailto:std-proposals+unsubscribe@isocpp.org>.
> To post to this group, send email to std-proposals@isocpp.org=20
> <mailto:std-proposals@isocpp.org>.
> To view this discussion on the web visit=20
> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAGg_6%2BMPQ=
TnqdWLQ1UV8jF173jDXYQQx-abwwNV3v3iknocJ%3DQ%40mail.gmail.com=20
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAGg_6%2BMP=
QTnqdWLQ1UV8jF173jDXYQQx-abwwNV3v3iknocJ%3DQ%40mail.gmail.com?utm_medium=3D=
email&utm_source=3Dfooter>.

--=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/f9ccebb4-6704-167c-5f1e-b0f58794a15d%40technion.=
ac.il.

.
