220 34288 <b3969fcf-964f-a8ef-622b-a9039a852367@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 18:57:39 +0200
Lines: 56
Approved: news@gmane.org
Message-ID: <b3969fcf-964f-a8ef-622b-a9039a852367@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>
 <2f48bdde-a6b6-473f-96ec-8836fd8de463@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"; format=flowed
X-Trace: blaine.gmane.org 1504544282 15278 195.159.176.226 (4 Sep 2017 16:58:02 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 4 Sep 2017 16:58:02 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:56.0) Gecko/20100101
 Thunderbird/56.0
Cc: std-proposals@isocpp.org
To: Nicol Bolas <jmckesson@gmail.com>
Original-X-From: std-proposals+bncBDHKZN7LR4ARBCMMW3GQKGQEUC6TUFY@isocpp.org Mon Sep 04 18:57:47 2017
Return-path: <std-proposals+bncBDHKZN7LR4ARBCMMW3GQKGQEUC6TUFY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lf0-f72.google.com ([209.85.215.72])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDHKZN7LR4ARBCMMW3GQKGQEUC6TUFY@isocpp.org>)
	id 1dougu-00030w-02
	for gclcip-std-proposals@m.gmane.org; Mon, 04 Sep 2017 18:57:40 +0200
Original-Received: by mail-lf0-f72.google.com with SMTP id c82sf468144lfc.13
        for <gclcip-std-proposals@m.gmane.org>; Mon, 04 Sep 2017 09:57:47 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1504544267; cv=pass;
        d=google.com; s=arc-20160816;
        b=m16mQ0mjfAyh6dJ3Ek7YeorC7svAztB4otW+9X8X2wWo9u9UBkDjOsmkFEmpxlnZMJ
         NDouw2FImmF5eQkBnCqOs+6cNcK/LTUnh8Ay3ojnWcRsTMHRgxBSRYwUtptmUhpIrgYm
         VSmLoEh7UsP+enqKuu/tMA4dwxzkoCO6dkSKnosvAEeBXPjnEsKci3a5FIHO6Y24iaHU
         VHxWrv3BNmrzMdthTa+9tfKsdiZb/6tK2PZHB1YC0yTV22QR5Kj31fgPIImhWpbP5ki7
         NbR8+ScgVEk4uE3OldTRbGWZrw5u8aFKjPyiR9DkhMfQhJs9UhW8QsNoIEyzlE7Jc+/v
         vJLw==
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-language
         :in-reply-to:mime-version:user-agent:date:message-id:from:cc
         :references:to:subject:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=ZzvuiM4sa98e83NLW5WlAxGh6ZaQS8TwA8KXB31zxrI=;
        b=EcQxBT+wkNWK6rCiQCp5SSkeu44hL+6MzGNuKaODsghfsgLhMz9G5ZIk+tPvJu17Oj
         oeYE2LElL3zaBtCZZMNXWP8mDY696a80pjjp1I7KZJ33Zc9kWbOqIsOkFewgIDVz39BU
         VIAEXwIdnKuawiuGZsN/BRcvv50NgTCgfpgRZ7EgSpBHOCdzFEdRyBlTFHfRUZBZV0AK
         Y6qujK2231RW84FuG/cDB1osvujVFGhpuGai9n5C02lPqMldSNM+fXkLtQfXGhTksXIs
         KBvVY/daZRVTdTI9P+QOQfV4bwq4UVCcWd3LsHrG5xcdT87sBUIL4slfodXN4C68BPSR
         s9Ww==
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:cc:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-language: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=ZzvuiM4sa98e83NLW5WlAxGh6ZaQS8TwA8KXB31zxrI=;
        b=gZLC4ojtdx6pXUFgmf5LR7QEZou51NGju/g7XyDYHhECocde6zzmpRkzTFRhHQ8yem
         3TvSM15837+vDBQ6XrcS5Kkq2WAgsYALAU28rIfqXIboQYNT1osxQ/BH3BIp2z+Aam0/
         d9+LqwiQIWvlVrmyacftmOmJOme2lNY+6aC/h7hvRvgzAFHpTOJ3EEdOIR+WEm6WM5HG
         YyksfL2XqgGDMaaXWa6X3YfKV/VjuLXC0PGaY2soK7nOrDp41X9QEsuQAzhEtW2iqM2d
         zMEOPzLY1rq/p2d5gXu4nu2Qure/BtKDKJUJt3RO0lRS2dgXlOgkGS2l8w3mQ+nPOtJr
         QLyQ==
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:cc:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-language
         :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=ZzvuiM4sa98e83NLW5WlAxGh6ZaQS8TwA8KXB31zxrI=;
        b=ab4SKz5u9mrOn4LliUlnS0AYrsOHLCZgA/Tg+85TljcdGA/k15GOFafl/iirlVW3Im
         DqPysOHwVAF14zNvd6A8/a3so6cOvtZLxlRBvI7iAFs+iL2DeCtyHZkPz3UwBWJqPiXP
         VgqQoHF17QgDeDgQX+r620qnGyIfrvB8M4PEmH4P+VNWUkG05ezqw7HvmdNQx3jvpvG4
         bnk5o7veYhtjJ1tjGOjbErjHWPVntkxoDP0sLCkbJEP07QmVphWOdMwQ6xuJxGHFIMDC
         BwOvZQc452SGAk3dZaRg5wdMU/1Q1+fZ17THrJz8c9MaASalhtgZkFMEJi6UWXG83qOr
        
X-Gm-Message-State: AHPjjUi+tc2Ao46KCSK4AN0pnJUvPEalNedVAH7M9jgxOwnHOT4+crA2
	Vf45zeV3ygnM8A==
X-Google-Smtp-Source: ADKCNb4RvnI5NW11dOt7NIT7op0OcYLrNMUKmANPEiioZfTh3so38jVOfguLEbXGELEAF/kdH/XAGQ==
X-Received: by 10.25.193.142 with SMTP id r136mr115508lff.6.1504544267349;
        Mon, 04 Sep 2017 09:57:47 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.158.142 with SMTP id h136ls200320wme.27.gmail; Mon, 04 Sep
 2017 09:57:45 -0700 (PDT)
X-Received: by 10.80.136.14 with SMTP id b14mr952281edb.295.1504544265555;
        Mon, 04 Sep 2017 09:57:45 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1504544265; cv=none;
        d=google.com; s=arc-20160816;
        b=lQMzXYNmzQneVC5jJskIVHZucjEzRs0D+RJVuhLHjv3E26XPztBXjLL+ghlNahBkSC
         MhxteZFRcWo9R9RKZrqIKU+5FG1Us8XKkshAxL3wlvCc8U2KDVmpkiDtfUvAfmtiwAIM
         6WBXd0kHPqb0ixWIMUmJq3OKD1XkcUNFAU3fpia6mldcjyixx2/toPX9TOB04UaQp64E
         vOEMO81ZunInDjxVHtGrfFvhCTUqmpqGeCG+F8v7DDu+uIAJNPXQfxIvri+yqfkesu96
         NEwxPEaD/OlDc0ihmKbm88AStjf8GJ1smYIiL65ZLBiFAcThnO5vGZnSpWTi0pdt9dCb
         dMAw==
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:cc:references:to:subject
         :arc-authentication-results;
        bh=o+c2okxICwCLH9Db+J63d6JhzOeBI3L0ePs1/n8Iegw=;
        b=jvrRXuUet+ARHjyfQKr5pclLOrW7Bu5jnIC4aSrW0gpH4VUHlFkRQFaHAML+dY+0F7
         kRgMDo9kdU2y/IT9mONb+VJyG8oK8HpVtYplhxncLtrmwLGEqqyl0n7mfSTdSoL2XiAQ
         9L/+qlsUqH0CICVohEiDzsnBG3Ce3iVtPY9+9TdKc9l9hgZBWKeIaRPz7uqMkzZXe1y1
         m/+MTq6nlRBP60CQLuev+Mpn6tAq+fkMvQJyuYc8f20YFPlVJ10B0Gz5A8I7OnROMI7r
         x8PF5dxUh5Qovje2IPO01fEM7WbrNWA6rwBZEFhLAR4Ae+Ew+HaiCMd0WDq0LejxrNyU
         sclA==
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 c9si8305355edl.502.2017.09.04.09.57.45
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Mon, 04 Sep 2017 09:57:45 -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 v84GviFg023499;
	Mon, 4 Sep 2017 18:57:44 +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 v84Gvird023497
	(version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO);
	Mon, 4 Sep 2017 18:57:44 +0200
In-Reply-To: <2f48bdde-a6b6-473f-96ec-8836fd8de463@isocpp.org>
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:34288
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/34288>



On 8/30/17 5:02 PM, Nicol Bolas wrote:
> 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?
 > ...


See my email to Nevin Liber from a couple of minutes ago. We are 
_already_ creating the type in this case (at least in one of the 
alternatives).

My - I would say tiny - suggestion is to add a bit more syntactic sugar 
for facilitating that, in the same vein as auto declaration of multiple 
non-struct variables. It makes coding the thing more fluent,.


Fluency, DRY. Also, apparently, replacing a Boost Spirit X3 macro which 
does this for us :-)
http://ciere.com/cppnow15/x3_docs/spirit/tutorials/employee___parsing_into_structs.html



 > Why did I make a struct out of it instead of just having a number of 
loose variables? ... 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?

No, you aren't - and that _is_ the whole point! If you had wanted a 
carefully-defined type with methods and such to pass around and expose, 
you would have gone to the trouble of defining it properly, and with a 
_name_.

Instead, you just fluently create the struct, with an anonymous 
"throw-away" POD type, without you having to mentally bother with the 
definition. This is actually reason (1.) you gave for using auto... You

"don't need to write the name of the type, since it is obvious by 
inspection."

and that's what I want too.

Eyal

-- 
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/b3969fcf-964f-a8ef-622b-a9039a852367%40technion.ac.il.

.
