220 28732 <ntlgq3$3tk$2@blaine.gmane.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Matthew Woehlke <mwoehlke.floss@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: A plea to reconsider adding Structured Bindings
 to language
Date: Wed, 12 Oct 2016 10:19:50 -0400
Lines: 46
Approved: news@gmane.org
Message-ID: <ntlgq3$3tk$2@blaine.gmane.org>
References: <201610051238.17863.marc.mutz@kdab.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Trace: blaine.gmane.org 1476283257 19666 195.159.176.226 (12 Oct 2016 14:40:57 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 12 Oct 2016 14:40:57 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
 Thunderbird/38.1.0
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC37LBFWUIFBBYUW7G7QKGQEFCWAJMA@isocpp.org Wed Oct 12 16:40:53 2016
Return-path: <std-proposals+bncBC37LBFWUIFBBYUW7G7QKGQEFCWAJMA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lf0-f70.google.com ([209.85.215.70])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC37LBFWUIFBBYUW7G7QKGQEFCWAJMA@isocpp.org>)
	id 1buKhs-00028Z-W3
	for gclcip-std-proposals@m.gmane.org; Wed, 12 Oct 2016 16:40:33 +0200
Original-Received: by mail-lf0-f70.google.com with SMTP id b81sf28763600lfe.1
        for <gclcip-std-proposals@m.gmane.org>; Wed, 12 Oct 2016 07:40:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=to:from:subject:date:lines:message-id:references:mime-version
         :user-agent: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=xbPW8G6w+J/9JQyHwCNSmHEoM6U2wVyjz0vN5K7dOBo=;
        b=JWeZbo2AedoRmunjS2vFZpMn414FwyQYv60+in2eZvH0AUDoLmbMiGuMJ4TjNaQpWM
         5v5PT93wRV5a1jjX7RNqP1eAAlUuOqXD1SfHCNOciWaA0tlIjaAkxXNQsTjhQ93xEIk2
         9vVZYjkr/7D5Mj1O8gpwGzlGmDQdHuobfQpsdiIcm+qGNKn52BA2AujNnuSF9Li7VoVw
         zXLKPIqPCdZPmZhgZXQ4ynxjT+zyJ7tQGJqGzfkpblq5j/eX5Kk3duRuL//NNFO1/80z
         h3qvLsJYkK0vYNwvLZYtU2fe9oTVzB4CNRQwjp1QXkq2iIX03GogfvWnO5Cknd0V2YKq
         4IvQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:to:from:subject:date:lines:message-id:references
         :mime-version:user-agent: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=xbPW8G6w+J/9JQyHwCNSmHEoM6U2wVyjz0vN5K7dOBo=;
        b=GGQ91wt2ao7k63GPR0mgz8yQQFoFZ9uFYVReejOzpYymDP0XTmJ1I6EXafH+vhbSwk
         WnNRhRN8pyklxFD8v0Ja4M/VdtmZHFQFiJebnUzNoYJ8T9IFy3NVde1Uy1r6JH6HdvMp
         XFmbdrmCufAGbFYeML2zL1g00gLCUDqZ771chRsWST87/bt2dDPwyoBuoVozlJqioi4g
         dChIaLqbqK/IrG8ZmpF/8XCqZci8dFGDmJrDY5RBg3kVbPU8Na33qLMXsnjegoXjAYNN
         XWnLKh4U2xCPLC0XhytwSdcUuJJzKUjvTgqpBbLJf3LCNJpm7LpZ5ri+O9xGm9g1YhLh
         zUgg==
X-Gm-Message-State: AA6/9RkZiWHyMPiBExzeSuh4irzDbqI8+Y6Ugk7KKOYlgfhxTr5BGGeDzwxOinK6GuhXuA==
X-Received: by 10.194.6.227 with SMTP id e3mr176463wja.11.1476283235203;
        Wed, 12 Oct 2016 07:40:35 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.25.205.140 with SMTP id d134ls429645lfg.33.gmail; Wed, 12 Oct
 2016 07:40:34 -0700 (PDT)
X-Received: by 10.25.165.71 with SMTP id o68mr1582898lfe.99.1476283234208;
        Wed, 12 Oct 2016 07:40:34 -0700 (PDT)
Original-Received: from blaine.gmane.org ([195.159.176.226])
        by mx.google.com with ESMTPS id o137si4976820lfo.33.2016.10.12.07.40.34
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 12 Oct 2016 07:40:34 -0700 (PDT)
Received-SPF: neutral (google.com: 195.159.176.226 is neither permitted nor denied by best guess record for domain of gclcip-std-proposals@m.gmane.org) client-ip=195.159.176.226;
Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2)
	(envelope-from <gclcip-std-proposals@m.gmane.org>)
	id 1buKhS-0007FL-Ee
	for std-proposals@isocpp.org; Wed, 12 Oct 2016 16:40:06 +0200
X-Injected-Via-Gmane: http://gmane.org/
Original-Lines: 39
Original-X-Complaints-To: usenet@blaine.gmane.org
In-Reply-To: <201610051238.17863.marc.mutz@kdab.com>
X-Original-Sender: mwoehlke.floss@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=neutral
 (google.com: 195.159.176.226 is neither permitted nor denied by best guess
 record for domain of gclcip-std-proposals@m.gmane.org) smtp.mailfrom=gclcip-std-proposals@m.gmane.org;
       dmarc=fail (p=NONE dis=NONE) header.from=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:28732
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/28732>

(Apologies if this posts twice; the original appears to have gotten lost.)

On 2016-10-05 06:38, Marc Mutz wrote:
> I heard about Structured Bindings for the first time at CppCon this year, and 
> I'd like to raise my concerns, esp. since half of the panel was crazy about 
> them.
>
> The reaons it's horrible, is because it reverses the C++ principle that the 
> implementor of a library should have to do the work, not the user.
> 
> It reverses the principle by requiring the *caller* to choose the names of the 
> values returned, when it should be the implementor of the function who chooses 
> the names.
>
> Structured Bindings would be acceptable if, like scripting languages, we 
> didn't have anything else to work with.
> 
> But we do: We can return a struct.
> 
> IMHO, the correct solution to the multiple return value problem is to return a 
> struct with properly named fields, not a pair and not a tuple.
>
> I believe there's a proposal for allowing to define structs in function 
> declarations already, but I failed to find it.

You are likely thinking of http://wg21.link/p0222 and
http://wg21.link/p0224. (I still need to merge and dust those off one of
these days...)

I agree that P0222 would be *much* better than returning pair/tuple, but
I also don't have a problem with assignment unpacking. I'm not convinced
that return values are so much more brittle than parameters that they
will make API stability much worse.

(That said, I wouldn't be overly heartbroken if S.B. was held back for a
revision. I'm not convinced that we've solved bitfields adequately.)

-- 
Matthew

-- 
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/ntlgq3%243tk%242%40blaine.gmane.org.

.
