220 32489 <d184a83a-4f99-a8d2-6bba-1b8aeedd797c@honermann.net> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Tom Honermann <tom@honermann.net>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Allow Structured Binding Outside of Variable Declaration
Date: Tue, 16 May 2017 12:36:52 -0400
Lines: 51
Approved: news@gmane.org
Message-ID: <d184a83a-4f99-a8d2-6bba-1b8aeedd797c@honermann.net>
References: <e02d79e8-7d80-4614-bd25-e73fb43dad9d@isocpp.org>
 <10b21241-b683-44d5-82ce-90681b2643a4@isocpp.org>
 <CAFk2RUbf5skMEcsLd_hUiZrib2bGCvyrJbgsx9LV-rXaj=fBZw@mail.gmail.com>
 <CAFk2RUbgg7UMc_mFGKQZF7-PVVbEDsdoZoXL46oyxr+PLRTfvw@mail.gmail.com>
 <08ff73f1-6989-393e-ee4e-8158af2e7bed@honermann.net>
 <CAFk2RUaBhq7KVukgRMvqBMuBiBwZmCf+xZpD9jRtBberFoU2Rg@mail.gmail.com>
 <c70b0cd6-fa3e-d215-3fef-06eb231ed3cd@honermann.net>
 <CAFk2RUbiUZ4n_mXdBUTGEZSsh5C=Mf0hKbKu76PKzCCWnZfrgA@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
X-Trace: blaine.gmane.org 1494952615 832 195.159.176.226 (16 May 2017 16:36:55 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 16 May 2017 16:36:55 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.2.0
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDBNXSHG6UDBBJOV5TEAKGQEJXTGXOQ@isocpp.org Tue May 16 18:36:49 2017
Return-path: <std-proposals+bncBDBNXSHG6UDBBJOV5TEAKGQEJXTGXOQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ua0-f199.google.com ([209.85.217.199])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDBNXSHG6UDBBJOV5TEAKGQEJXTGXOQ@isocpp.org>)
	id 1dAfSq-0008Un-Vo
	for gclcip-std-proposals@m.gmane.org; Tue, 16 May 2017 18:36:49 +0200
Original-Received: by mail-ua0-f199.google.com with SMTP id 50sf53849938ual.5
        for <gclcip-std-proposals@m.gmane.org>; Tue, 16 May 2017 09:36:54 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1494952614; cv=pass;
        d=google.com; s=arc-20160816;
        b=tfg1STtGfQY7bCeKmpsquu+Nw5wSAyB+WtKipipj1hSWVd8WCD+/c0J8lxVo5HO5JO
         K6XZ33UwphQQWIytJ96npbliJGK4EEtGvhsw7Z9WTnUdzumBYTeB2Pq9I0UVs1a7pRAb
         s9pjXHrxlwbMJzNQh2K6Dk/nH5HmCl6K0+W7sOqjcLBK2SLAOcLMgdNdBoH0Hvd9yB3l
         +afzg+R6yfTqxhoZQVmlldePW5N3re2mTa7A4/ohyqqeEfBo3JQIN9q3Q06kQb5rMnZB
         AJaaA4xTd2GMwsgCvm87iP42L5xWiY1qaBdyGxXdeaW6VSHqmljKKsGKpQU+ym1d9Deo
         hqrw==
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: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=v/iRw5tCtmV1tGRfvXCBHtxtRdLGgmJJU6/eeNoZ204=;
        b=VkqeQ6SYXZAjprZJ4SmEp0ovKfMI25JIrJK3iuUCoZ8l9gb384iqd844M5eP8VNi0w
         42wxgH0/SDzLpx7nn1wjmw/VIkWTrg2VRLnCwXeTYs6O3Q28h67Rm+BcFGJUZJb2YpyC
         2MYGq2GAtzIUxmkt6G1OzwqjI06Va5NNWHEmtiY2SheQ5aW92QZ6tEPOXdz7WC/tYsUH
         C4HJbzt+pADnmzO6vvi0qriVxVr9R3ffTtmEwJJQ9s65V0cxAfKz1dHcdXaBghqUaK0z
         mVzw+6OeEWsH3MdXDFqB9F76KzkiJwShx3LG4NOTWQ31dnMpTc4no6sU2PsjhEvKvvYT
         iR7A==
ARC-Authentication-Results: i=2; mx.google.com;
       spf=neutral (google.com: 173.203.187.75 is neither permitted nor denied by best guess record for domain of tom@honermann.net) smtp.mailfrom=tom@honermann.net
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: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=v/iRw5tCtmV1tGRfvXCBHtxtRdLGgmJJU6/eeNoZ204=;
        b=YebzoEzIlzFe+9+dTs82u4vuHDJHmVDHXAtvy+LCYOmHfkma2CdonEMrqIc7CkJ78U
         rPhdawo133pdfPw1ZZfZez4Hye/MGMQkj2GeBu3VVXRUmiZ1CL4B7IId4I3N4mcw30SJ
         t75eg7jbG4ULJ/xOPVJUzcvDM8ifslMUfEohUSGO+3lalrOeVs1QiH4Z0CR9lCQ7xLbM
         JqRGkxyYrrpvXZTJNJG5ocsHv+0/xVbRw01O6MOs4SnxwdbnluaxLIcFHtAqlrJ9sTYp
         u22uO/Bvnz+pFrzt97FBDeyC4MGYHgQdmxOYmurF8kCVUOZJLIlzBii1PxmN7kXZl6Nu
         Q8oQ==
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: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=v/iRw5tCtmV1tGRfvXCBHtxtRdLGgmJJU6/eeNoZ204=;
        b=iOsM/70J+En6PE/3sbTgOrAjLZ0Jf3mi7gJLoQvfeb7aW4vwnD0wV8rGD02S/H/t55
         zicpxn+f6c4ira1q0yLLpbIMvRnpIdcgksS/Y0Qe9ppbufDhHd1Jftk/5S1ASAgDtrVr
         SDTfgRKSszCgyJvyVC1Yp4irEqRHOY56fqGKi3b/VMUEQsUlNuf52YcxGrquMXU94hu/
         Ji6fK/NnV+TZLJkdm3yVv1xiBmsH69tBR62T1ep+9irpLhrKDWV+r/NZ/z21jtaNKBkg
         nHiUXsL00fau7vpTug32IiB81gs6Uyje41AYnnTaKac6BJq1Qr+X/Kyrx09CKdkJllly
         acqg==
X-Gm-Message-State: AODbwcAqA9IMDdGavM73CEATuj2EktSyiKfYn3t2nka5XgkMQk8P5uqh
	yCD7+U5dLLxY9w==
X-Received: by 10.176.23.22 with SMTP id j22mr5033120uaf.15.1494952614175;
        Tue, 16 May 2017 09:36:54 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.73.129 with SMTP id g1ls1709737otf.32.gmail; Tue, 16 May
 2017 09:36:53 -0700 (PDT)
X-Received: by 10.237.34.246 with SMTP id q51mr12411220qtc.39.1494952613416;
        Tue, 16 May 2017 09:36:53 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1494952613; cv=none;
        d=google.com; s=arc-20160816;
        b=bVTquz1ocDeM1/CfRbEvdfGibOoymx949xv4a7R4vKRcXWVCZ3KEFWn1Qj2gBvMIhl
         Mdhsdiq+6ir9iSv+MQOKaLczTiMlPzJ0P0HoKwLOGqPVzoZe3qSfMCXzqAeapmyUc/HB
         tkIlDv9AnNU9YjWXR2XJ9UvCTVM75YiATbt/DubQH8oN/g+1zwsA0QDs5QNvOy6w5e3J
         NkyhCRO3w8ovq4mTTRMPaiRu+1nk9kRP9WLk2Pi9zFPdEdzrbx3ab2jvN1ndlpvC5/uK
         jfCQ7pd2e/1pVPKsxhu2h4KLwDTiMjlswgT43V4Sm9/Y9lJWgy03DvqWRr/Ce+69RIdd
         LpZQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-transfer-encoding:in-reply-to:mime-version:user-agent:date
         :message-id:from:references:to:subject:arc-authentication-results;
        bh=nYNNVKJKZNl3HjzWeglOj94VI8AgaYHFIVwbuKbAIxs=;
        b=T3xpKtWbKHJ+gh/HstyklJmacrXU7+rjdpqw6tdVvp1wtsL0WwlOuXSD9Xyye065AC
         0SWD408WxNbZEWodRFNEjRLCxF3+07k76X6NWIz7fVaCaQKWFS6W+GAsOgjHfzP7GzP7
         BjxHiCfXpvc1G/bkktcCDaDrpUzSYtp5znj00lHSLJ4YrWoxkdVItxMbaB3LvMgH1m/n
         JpTHztPIEL/BBiqN97HAuiyWy8AY8rWXKYSGdyUHQqOVajO/UGZfZE++HaxCIvyiEiNw
         K5sa5fBDbKfnyOPFHeoz9t32PnnuFoB2AhCmbY3+K4nd+FIrUNHe5JECau+vDGnEvTYm
         jfcg==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=neutral (google.com: 173.203.187.75 is neither permitted nor denied by best guess record for domain of tom@honermann.net) smtp.mailfrom=tom@honermann.net
Original-Received: from smtp75.iad3a.emailsrvr.com (smtp75.iad3a.emailsrvr.com. [173.203.187.75])
        by mx.google.com with ESMTPS id 15si14046903qtu.248.2017.05.16.09.36.53
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 16 May 2017 09:36:53 -0700 (PDT)
Received-SPF: neutral (google.com: 173.203.187.75 is neither permitted nor denied by best guess record for domain of tom@honermann.net) client-ip=173.203.187.75;
Original-Received: from smtp10.relay.iad3a.emailsrvr.com (localhost [127.0.0.1])
	by smtp10.relay.iad3a.emailsrvr.com (SMTP Server) with ESMTP id 1BB5565D8
	for <std-proposals@isocpp.org>; Tue, 16 May 2017 12:36:53 -0400 (EDT)
X-Auth-ID: tom@honermann.net
Original-Received: by smtp10.relay.iad3a.emailsrvr.com (Authenticated sender: tom-AT-honermann.net) with ESMTPSA id 055E8652D
	for <std-proposals@isocpp.org>; Tue, 16 May 2017 12:36:52 -0400 (EDT)
X-Sender-Id: tom@honermann.net
Original-Received: from [192.168.1.7] (pool-173-53-30-126.rcmdva.fios.verizon.net [173.53.30.126])
	(using TLSv1.2 with cipher DHE-RSA-AES128-SHA)
	by 0.0.0.0:587 (trex/5.7.12);
	Tue, 16 May 2017 12:36:53 -0400
In-Reply-To: <CAFk2RUbiUZ4n_mXdBUTGEZSsh5C=Mf0hKbKu76PKzCCWnZfrgA@mail.gmail.com>
X-Original-Sender: tom@honermann.net
X-Original-Authentication-Results: mx.google.com;       spf=neutral
 (google.com: 173.203.187.75 is neither permitted nor denied by best guess
 record for domain of tom@honermann.net) smtp.mailfrom=tom@honermann.net
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:32489
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/32489>

On 05/16/2017 11:30 AM, Ville Voutilainen wrote:
> On 16 May 2017 at 18:25, Tom Honermann <tom@honermann.net> wrote:
>>>>            auto [k -> Key, =in] = parseKey(in);
>>>>            if (*in++ != ',') throw Failure();
>>>>            auto [v -> Value, =in] = parseValue(in);
>>>>            if (*in++ != ')') throw Failure();
>>>>            return {KVPair(k, v), in};
>>>>        }
>>>
>>> Well, with the idea I cobbled together, I can write
>>>
>>> auto [x, =k->Key] = parseKey();
>>>
>>> and it means something completely different, because -> is a member
>>> access operator. So we can safely
>>> assume that k is an entity that supports operator->, and my binding
>>> there assigns to k->Key. It's such fun
>>> to try to extend a language where all good syntaxes have been taken a
>>> long time ago. :)
>>>
>> Oh, well, the solution to that is, of course, keyword spackling.
>>
>> auto [x, =k-> typename Key] = parseKey();
>>
>> :)
>
> What makes you think Key is a typename? :P
>
Because when I wrote that, I was intending to write a type constraint 
and not a member access.  You can tell because I put 'typename' there :P

Also because 'Key' starts with an uppercase letter but isn't all upper 
case letters.  As we all know, that means it unambiguously designates a 
type.

Actually, a type constraint doesn't makes much sense for an assignment 
binding, and a member access doesn't make much sense for a structured 
binding, so perhaps there is no ambiguity after all.

auto [x -> SomeType, =k->Key] = parseKey();  // Constrains 'x' to 'SomeType', assigns 'k->Key'

Yes, there is a certain amount of ick factor there.

Tom.

-- 
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/d184a83a-4f99-a8d2-6bba-1b8aeedd797c%40honermann.net.

.
