220 28523 <CAKgx6B+kywTPwYVRt3P5KDQ_=xMUuHzSJv6x21L5j1ExPz6bkQ@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Domen Vrankar <domen.vrankar@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: A plea to reconsider adding Structured Bindings
 to language
Date: Wed, 5 Oct 2016 13:40:20 +0200
Lines: 139
Approved: news@gmane.org
Message-ID: <CAKgx6B+kywTPwYVRt3P5KDQ_=xMUuHzSJv6x21L5j1ExPz6bkQ@mail.gmail.com>
References: <201610051238.17863.marc.mutz@kdab.com> <CAFk2RUYZDrLfm7QJtTiGEOdV52K3Kvv1ZdeKvoUfd2U2Ns32MA@mail.gmail.com>
 <201610051300.02280.marc.mutz@kdab.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a114a9686bae80e053e1ca664
X-Trace: blaine.gmane.org 1475667689 12644 195.159.176.226 (5 Oct 2016 11:41:29 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 5 Oct 2016 11:41:29 +0000 (UTC)
Cc: Ville Voutilainen <ville.voutilainen@gmail.com>, Herb Sutter <hsutter@microsoft.com>, 
	Bjarne Stroustrup <bjarne@stroustrup.com>, Gabriel Dos Reis <gdr@microsoft.com>
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCHJ3Z4NUUFBBTON2O7QKGQEHVYTDLQ@isocpp.org Wed Oct 05 13:41:23 2016
Return-path: <std-proposals+bncBCHJ3Z4NUUFBBTON2O7QKGQEHVYTDLQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-vk0-f71.google.com ([209.85.213.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCHJ3Z4NUUFBBTON2O7QKGQEHVYTDLQ@isocpp.org>)
	id 1brkZO-0000LN-G2
	for gclcip-std-proposals@m.gmane.org; Wed, 05 Oct 2016 13:41:06 +0200
Original-Received: by mail-vk0-f71.google.com with SMTP id 83sf122862883vkd.3
        for <gclcip-std-proposals@m.gmane.org>; Wed, 05 Oct 2016 04:41:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :cc: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=Zz1E3TSPPdJuTgM6dpbjvqBzG8THof5ZP9/m0eWPtBI=;
        b=tdbkZahNIn5XiiX3c05k/F77ZlFQkLJud7c/qZ37pvwlVCMiTGlu7aELwrR3aJndWp
         xx0MVkgV5o3k22JWDhi+BeeIYFCbA92m/CozzIad9Y8os/nu3ousDJN5hrXdvc1yJMQ/
         oQETHf9K8P4X90drH+IaTaToa1fSqXPopdTZJuFL3R3l7p4igzrnEppwwLHWjWMBhLj9
         127+yZvatxqZGms09Pq6ZdWT9j6aaEcp8OqDoJI7auS0tyanDD0MXgSCHn2jhwpWdos7
         48w+UKSz5XD84C+pvtuCTU3MFHbDqU1hwYzuZbyj1TVkAZIJvanAoEMk+0zSVCyeecdj
         shvA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:to:cc: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=Zz1E3TSPPdJuTgM6dpbjvqBzG8THof5ZP9/m0eWPtBI=;
        b=AAHb4hDKVXWijLbab1Ro0B48iSFEkeAUvSgb5N10HHLjVmFSVDD+EDYKc8ZaOQjSzE
         4SfNaGmBRFqLnQCdfwnye3Nn7EfMEay4+Ebe/l6v6FHAJJMhKFUOGRMTgkF+FhktBz4F
         YYto5Ylu3swWxn6cDEQjCYIPYVtDllHcoAjvMvm0QoSDQrmcvAbO8dRWjER2jZXjnIPW
         gnhluQayeBVelR705XDyKaV/Ash+b3hWAvYpMV3BG+rQC00OZynQpRKd8WsfSo/ovfrS
         b6aI2NJOUyFgdohFWf3lZemFWvUDSIOdPBFfuvVex2Gg4wXXoBUFLqLxmF89XWmjuPQr
         k3aw==
X-Gm-Message-State: AA6/9Rkdy6wVwcldzVyttNBY9io8Kj0w74yZU7D1jUIYNSzYlfgJWePsXHL/KCohsoINMg==
X-Received: by 10.176.84.7 with SMTP id n7mr2066413uaa.31.1475667668242;
        Wed, 05 Oct 2016 04:41:08 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.11.162 with SMTP id 34ls257153iol.13.gmail; Wed, 05 Oct
 2016 04:41:01 -0700 (PDT)
X-Received: by 10.107.55.85 with SMTP id e82mr9462079ioa.14.1475667661284;
        Wed, 05 Oct 2016 04:41:01 -0700 (PDT)
Original-Received: from mail-it0-x230.google.com (mail-it0-x230.google.com. [2607:f8b0:4001:c0b::230])
        by mx.google.com with ESMTPS id m93si12279935ioo.190.2016.10.05.04.41.01
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 05 Oct 2016 04:41:01 -0700 (PDT)
Received-SPF: pass (google.com: domain of domen.vrankar@gmail.com designates 2607:f8b0:4001:c0b::230 as permitted sender) client-ip=2607:f8b0:4001:c0b::230;
Original-Received: by mail-it0-x230.google.com with SMTP id 188so99848227iti.1
        for <std-proposals@isocpp.org>; Wed, 05 Oct 2016 04:41:01 -0700 (PDT)
X-Received: by 10.36.116.18 with SMTP id o18mr9672237itc.84.1475667660824;
 Wed, 05 Oct 2016 04:41:00 -0700 (PDT)
Original-Received: by 10.50.134.168 with HTTP; Wed, 5 Oct 2016 04:40:20 -0700 (PDT)
In-Reply-To: <201610051300.02280.marc.mutz@kdab.com>
X-Original-Sender: Domen.Vrankar@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of
 domen.vrankar@gmail.com designates 2607:f8b0:4001:c0b::230 as permitted
 sender) smtp.mailfrom=domen.vrankar@gmail.com;       dmarc=pass (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:28523
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/28523>

--001a114a9686bae80e053e1ca664
Content-Type: text/plain; charset=UTF-8

>
> > > 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.
> >
> > Structured bindings work with structs as well. If you think structured
> > bindings mean
> > you must return a tuple, you're mistaken.
>
> Yes, I know that. But if I return a struct with proper names, I don't need
> SB
> to handle it. Indeed, it would be counter-productive to have to find names
> for
> SB if can access the names the implementor chose with C-space in my IDE
> from
> the auto variable that stores the return type.
>
>
So you're saying that returning a structure with error status and result or
multiple results of which you only need one or two (reason being for eg.
cheaper to return all at once - due to for e.g. web service call or complex
processing - than request one by one on need to basis) you would still
prefer dragging the entire structure around giving the feeling that your
code has more dependencies than it actually does? Pattern matching would
probably be better for some cases but it's sometimes nice to have a simpler
tool handy.


> > > I fear Structured Bindings will lead to an explosion of *really* bad
> API
> > > that returns std::pair or std::tuple when it should return a small
> > > struct with
> >
> > C++ programmers are not idiots.
>
> C++ programmers are humans, though.
>
> We all make mistakes. Even Alex Stepanov did. The art is to not repeat
> them.
>
>
This sounds like an argument for not having templates, pointers,
exceptions, probably even references or any other feature for that matter.

I have ideas on where to use this feature but like with all other features
it'd be pretty odd to sprinkle it around the code just because I can and
make odd library apis. Good, poor and all in between designs are already
present so I doubt that this feature will change that too much but I might
be wrong :)

Regards,
Domen

-- 
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/CAKgx6B%2BkywTPwYVRt3P5KDQ_%3DxMUuHzSJv6x21L5j1ExPz6bkQ%40mail.gmail.com.

--001a114a9686bae80e053e1ca664
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote"><blo=
ckquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left=
:1px solid rgb(204,204,204);padding-left:1ex"><span class=3D"gmail-">
&gt; &gt; Structured Bindings would be acceptable if, like scripting langua=
ges, we<br>
&gt; &gt; didn&#39;t have anything else to work with.<br>
&gt; &gt;<br>
&gt; &gt; But we do: We can return a struct.<br>
&gt;<br>
&gt; Structured bindings work with structs as well. If you think structured=
<br>
&gt; bindings mean<br>
&gt; you must return a tuple, you&#39;re mistaken.<br>
<br>
</span>Yes, I know that. But if I return a struct with proper names, I don&=
#39;t need SB<br>
to handle it. Indeed, it would be counter-productive to have to find names =
for<br>
SB if can access the names the implementor chose with C-space in my IDE fro=
m<br>
the auto variable that stores the return type.<br>
<span class=3D"gmail-"><br></span></blockquote><div>=C2=A0</div><div>So you=
&#39;re saying that returning a structure with=20
error status and result or multiple results of which you only need one=20
or two (reason being for eg. cheaper to return all at once - due to for=20
e.g. web service call or complex processing - than request one by one on
 need to basis) you would still prefer dragging the entire structure=20
around giving the feeling that your code has more dependencies than it=20
actually does? Pattern matching would probably be better for some cases=20
but it&#39;s sometimes nice to have a simpler tool handy.<br>=C2=A0</div><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft:1px solid rgb(204,204,204);padding-left:1ex"><span class=3D"gmail-">
&gt; &gt; I fear Structured Bindings will lead to an explosion of *really* =
bad API<br>
&gt; &gt; that returns std::pair or std::tuple when it should return a smal=
l<br>
&gt; &gt; struct with<br>
&gt;<br>
&gt; C++ programmers are not idiots.<br>
<br>
</span>C++ programmers are humans, though.<br>
<br>
We all make mistakes. Even Alex Stepanov did. The art is to not repeat them=
..<br><br></blockquote><div>=C2=A0</div><div><div>This sounds like an argume=
nt for not having templates, pointers, exceptions, probably even references=
 or any other feature for that matter.<br><br>I
 have ideas on where to use this feature but like with all other=20
features it&#39;d be pretty odd to sprinkle it around the code just=20
because I can and make odd library apis. Good, poor and all in between desi=
gns are already present so I doubt that this feature will change that too m=
uch but I might be wrong :)<br></div><div><br></div><div>Regards,<br></div>=
Domen <br></div></div><br></div></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/CAKgx6B%2BkywTPwYVRt3P5KDQ_%3DxMUuHzS=
Jv6x21L5j1ExPz6bkQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAKgx6B%2Bkyw=
TPwYVRt3P5KDQ_%3DxMUuHzSJv6x21L5j1ExPz6bkQ%40mail.gmail.com</a>.<br />

--001a114a9686bae80e053e1ca664--

.
