220 39296 <CALvx3haDm01D7jCvJJA3JJycraXVZ_WHz9A4md5h1WXhCR29cg@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Richard Hodges <hodges.r@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Standardising a type-erased iterator
Date: Mon, 23 Jul 2018 10:14:44 +0100
Lines: 158
Approved: news@gmane.org
Message-ID: <CALvx3haDm01D7jCvJJA3JJycraXVZ_WHz9A4md5h1WXhCR29cg@mail.gmail.com>
References: <09db196a-e818-4d7a-9af1-48f07b2f4c3d@isocpp.org>
 <CALvx3hZkVPxg3E0MBPBeXnNwK9szQ5o6O7Gs2ab_omXt8R8=qw@mail.gmail.com>
 <24d8f121-aba9-4ead-b107-bc4b72014870@isocpp.org> <CALvx3hbfFAyh7twxd73DdPYXkrs8chxjsRL9kYzd5kk2VmgD1Q@mail.gmail.com>
 <c9664ef6-f769-4942-8e44-56761d091efc@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="00000000000032dd380571a714ce"
X-Trace: blaine.gmane.org 1532337171 26170 195.159.176.226 (23 Jul 2018 09:12:51 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 23 Jul 2018 09:12:51 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBD4PBM7UWAHRBEFZ23NAKGQEF2QACAA@isocpp.org Mon Jul 23 11:12:47 2018
Return-path: <std-proposals+bncBD4PBM7UWAHRBEFZ23NAKGQEF2QACAA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-it0-f71.google.com ([209.85.214.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBD4PBM7UWAHRBEFZ23NAKGQEF2QACAA@isocpp.org>)
	id 1fhWta-0006gY-Oh
	for gclcip-std-proposals@m.gmane.org; Mon, 23 Jul 2018 11:12:47 +0200
Original-Received: by mail-it0-f71.google.com with SMTP id z8-v6sf210541itc.9
        for <gclcip-std-proposals@m.gmane.org>; Mon, 23 Jul 2018 02:14:57 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1532337297; cv=pass;
        d=google.com; s=arc-20160816;
        b=RyxHNqiRj/Ov2SPxfiAUbJ3HiUxc5HiglLnZGMYffFaBy5q7lWmfOcWU//OT0h4x/o
         JIOB//wZNW2UG7KJxB9Qn/xZvUyattOQpuxs2pMknAReUzUjB+JoU1tIrEdf3tKYpFUv
         nH+51n72rNJi08H9+V6DeezojRN7tn6FNWrb4DrFr9Q0bJ4VhMzezK/r9XIKXiCqqUA4
         aVq3uDvl8tyJhAX/wDdyGtL+U6Qj1mvVSGkhqdZfqAO+IHukIwGR56/yFn3PDgPriNhb
         kT4PiRUjuqh0+9O7OFH19iH+yWjVxVn5FeSIr8pQJFak1h84uwebUBO6sDSWMPoA1LmT
         t3NA==
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:to:subject:message-id:date
         :from:in-reply-to:references:mime-version:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=Qx5WRtNcMsgXIcrlCnJNmdO6gYLs5Yd7A3lYJIj7FX8=;
        b=Rid4QPDaE8c9K+PJ8bweqf1SJcxeq9AHWF0MfJXnS7sS1xfOrNB1+KXy4JlNlmOhAw
         bWmOIp6R76PLJp+MAsUnU9ymbKO3hbS7Jgqd8niuw3c6c7UnmI7EYCpd9G7ttKZE1Xhg
         BVekz0xMyQ0oTEOZWvwGDaEBWCwY+HWu3eYwpJ50Dg5Zt61dcvksmEe8CuLoG+ByAbIT
         //Dun+1o1u/lxEzOrlorunqzMvMdtHhsUrOOJ6wy2X1dSgpPSqc17FqMcS/ZkC+6t0RT
         kty2W88ecbkiIvDwyoTCb4+Xw2vyUa/APSoieqCQbMj0S673aKKVh1f/Hceiusatg4QE
         U7gA==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=NFenCtZs;
       spf=pass (google.com: domain of hodges.r@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=hodges.r@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:references:in-reply-to:from:date:message-id:subject:to
         :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=Qx5WRtNcMsgXIcrlCnJNmdO6gYLs5Yd7A3lYJIj7FX8=;
        b=zXmlUyIy4Gw+7kyVhbZqerDh3bHsA3KpB2A6tWJ1VEM0LsPuB8/4o5cmi31YNS0/TI
         ScudB3h0oonlbXJVd0eI57GxgaM/5WgA/Oh2a6YWdz5pCQi1JFww0goPhw2aeX8HLyI+
         JNpoQlyea/R47NMGEtM7ncwgKoqSDtriQM5h9aeZ+NgwAVost1i3gUEqvEEbw5KPVFHT
         HLgdb1bwtSpWYknPCYjOyOAhOqLEbVJutDKRA5JMklpyt5akrzBM8N2gUgqQntfzyau5
         ymT7nNu/lv8+QXsuXi1L2h/V75YWQS45R9K0h3VYNmR0lNe+ri9Bv/5QtBu8NQ7PFGV2
         qk+Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:references:in-reply-to:from:date
         :message-id:subject: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=Qx5WRtNcMsgXIcrlCnJNmdO6gYLs5Yd7A3lYJIj7FX8=;
        b=TSMcgak0YP99IMPt7aO/EZxkqTH6nNkjOVQyqkLlL216rIt8NXo4MBUAzuK2K31Egb
         D5se/V3Rzee+rL60NcRCxJcqwMbmJhVmQicDjtDq/RD/xfHgh/Nzn5Z387LxvKwE/eoL
         xcMtBBHLD9uofNG5wzhB0KgJKX9vqBw4Nv5KPwDf++Mbxyhbql1AZvhCEoDcQ94oKNTk
         9FyNKg1Aj0XQD3/gWMkxCedD5kQP+HuUptCLe5C3FZsD2ndxoay/TxN8O3ZWfyf7xfuY
         8MHMmbwfC1Nhx5LHDPLpvJxA9rEJK+nUwEz3J5CmOi2kLKsMy+vQbDlbE+V754I1R0RI
         +PnA==
X-Gm-Message-State: AOUpUlHn5+m/xJbLEiNfyuv5ymBxIAoe3q8BzjTeJH8BpESKQZwLjGUu
	PEOTd/Q6IOf0YA9FoeLbWuQkhA==
X-Google-Smtp-Source: AAOMgpeKqva5RShvWX1F6HkBg/LGFY7n87K7XBcAf6rt/Qt452t9R9JJnFXa7Peaf/tJP/H+wIrN+A==
X-Received: by 2002:a24:ed87:: with SMTP id r129-v6mr5734630ith.32.1532337297363;
        Mon, 23 Jul 2018 02:14:57 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a24:500f:: with SMTP id m15-v6ls1142989itb.4.gmail; Mon, 23
 Jul 2018 02:14:56 -0700 (PDT)
X-Received: by 2002:a24:8206:: with SMTP id t6-v6mr385299itd.132.1532337296392;
        Mon, 23 Jul 2018 02:14:56 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1532337296; cv=none;
        d=google.com; s=arc-20160816;
        b=LXp7aCN1hokCj01Pa+iNCLfrAj12GGB+n31+vlCeRavC2WJjM6f54sfog1aN7YQJX0
         ju7FW+vI+wEuSz+JlA4do6u4ikNqtHM1znTYkmBQobN0gcwiOA0CfZMFICEH3DOqHHq1
         FYU+1PBS4S0urJ9svjAz19TnGPkVYkw7BjDZFGJ46ne1GRYXySr8S9t80lScorSPQsFv
         0p3ghBmVfYQ1sCaHOx86DedgfvqTDMVplz5FJvQ4MNLq4yEVDK0HlelkV+38i+Aj0MWk
         C+uWu+7sxzj7bLsdT0FDXZz6B0IlHEnEgv7VJLHkGkA3xLGAM37TgykRCDYKDXvwFThd
         HyHQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:in-reply-to:references:mime-version
         :dkim-signature:arc-authentication-results;
        bh=aYV6zauTgo22b3NhSFCsbM2ROlsZUQWHvlbHcwNdjBc=;
        b=Cu78r658/eJmnJg4HFNMyx28YW4mUEppLP/zg/5TK5CJr8wt0EZPfL+bg4HDCvOtYp
         oRRapgDgcv9CFh1pYCUlpE9kUa9SQuDKxTp+KEiXFvTsY054MMvr2ZVlCOGCLl6ukL82
         jy5fiKpyoHaLvY+TOEVv9dFhymFUeoHf/Dkg/BbLA/3WHCKvWNNW0tGYsZSN/TVCdWFu
         K33cWUFyUsd1zTZwbLFSEWYrd52iV4P2j0nDfziAPOiFpMdpt8OrygX4OISoyJ3c29m7
         F3isKxQBsBlGaPOpw0wmCnMItTMCm0fCjYQ/zWuCr59bNXlAjKlPmMV7Dixwqw3+ECt2
         3iXw==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=NFenCtZs;
       spf=pass (google.com: domain of hodges.r@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=hodges.r@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Original-Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id e23-v6sor3429411jaj.121.2018.07.23.02.14.56
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Mon, 23 Jul 2018 02:14:56 -0700 (PDT)
Received-SPF: pass (google.com: domain of hodges.r@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 2002:a02:579a:: with SMTP id b26-v6mr10682292jad.107.1532337295906;
 Mon, 23 Jul 2018 02:14:55 -0700 (PDT)
In-Reply-To: <c9664ef6-f769-4942-8e44-56761d091efc@isocpp.org>
X-Original-Sender: hodges.r@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=NFenCtZs;       spf=pass
 (google.com: domain of hodges.r@gmail.com designates 209.85.220.41 as
 permitted sender) smtp.mailfrom=hodges.r@gmail.com;       dmarc=pass (p=NONE
 sp=QUARANTINE 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-Spam-Checked-In-Group: 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:39296
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/39296>

--00000000000032dd380571a714ce
Content-Type: text/plain; charset="UTF-8"

On Mon, 23 Jul 2018 at 09:01, Thomas Russell <thomas.russell97@gmail.com>
wrote:

> The motivation is similar to having any standard type-erased facility; it
> gives a concrete interface that accepts an arbitrary set of classes that
> conform to the required concepts.
>
> The closest existing parallel in the standard library is `std::function`,
> modelling the Callable concept.
>
> Having such a facility as a vocabulary type provides various benefits over
> function templates accepting Callables:
> - Reduced generated code-size (this can even go some way towards reducing
> the performance penalty).
> - Works with the OOP paradigm (virtual functions cannot be function
> templates)
> - Reduced compile-time
> - Can work across dynamically-linked library boundaries, providing the
> correctly corresponding build parameters are met.
>
> I think these are good motivations, but am interested to hear opposing
> opinions.
>

I think it would be fair to say that they are theoretical or hypothesised
motivations, not actual concrete use cases where there is a demonstrable
benefit in providing a standardised type-erased iterator suite.

I'm thinking in terms of "here's some current software that sucks because
we don't have type-erased iterators, and presented here is a better version
using my implementation of such iterators".

I say this not to be argumentative.

I say it because like you and many others, I have played with similar ideas
because they were fun or interesting ideas. Including for example a
type-erased iterator for iterating across a tuple (operator* returns a
boost::variant of references).

However, in 30 years on and off writing commercial software, I have never
encountered an actual use case while using c++.

This is probably because I reach for c++ when seeking concrete guarantees
on type safety, and python, perl or javascript when I'm seeking type
flexibility and expressiveness.

But it could be that I am thinking myopically. I have experimented in the
past with providing more "script-like" library objects to the odd project.
Again, out of curiosity more than need.

You see what I'm saying? Is this in reality a fun personal project, or is
there a tangible benefit to me if I find this in the std toolbox?


>
> --
> 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/c9664ef6-f769-4942-8e44-56761d091efc%40isocpp.org
> .
>

-- 
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/CALvx3haDm01D7jCvJJA3JJycraXVZ_WHz9A4md5h1WXhCR29cg%40mail.gmail.com.

--00000000000032dd380571a714ce
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Mon=
, 23 Jul 2018 at 09:01, Thomas Russell &lt;<a href=3D"mailto:thomas.russell=
97@gmail.com">thomas.russell97@gmail.com</a>&gt; wrote:<br></div><blockquot=
e class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc sol=
id;padding-left:1ex">The motivation is similar to having any standard type-=
erased facility; it gives a concrete interface that accepts an arbitrary se=
t of classes that conform to the required concepts.<br>
<br>
The closest existing parallel in the standard library is `std::function`, m=
odelling the Callable concept.<br>
<br>
Having such a facility as a vocabulary type provides various benefits over =
function templates accepting Callables:<br>
- Reduced generated code-size (this can even go some way towards reducing t=
he performance penalty).<br>
- Works with the OOP paradigm (virtual functions cannot be function templat=
es) <br>
- Reduced compile-time<br>
- Can work across dynamically-linked library boundaries, providing the corr=
ectly corresponding build parameters are met. <br>
<br>
I think these are good motivations, but am interested to hear opposing opin=
ions. <br></blockquote><div><br></div><div>I think it would be fair to say =
that they are theoretical or hypothesised motivations, not actual concrete =
use cases where there is a demonstrable benefit in providing a standardised=
 type-erased iterator suite.</div><div><br></div><div>I&#39;m thinking in t=
erms of &quot;here&#39;s some current software that sucks because we don&#3=
9;t have type-erased iterators, and presented here is a better version usin=
g my implementation of such iterators&quot;.</div><div><br></div><div>I say=
 this not to be argumentative.</div><div><br></div><div>I say it because li=
ke you and many others, I have played with similar ideas because they were =
fun or interesting ideas. Including for example a type-erased iterator for =
iterating across a tuple (operator* returns a boost::variant of references)=
..</div><div><br></div><div>However, in 30 years on and off writing commerci=
al software, I have never encountered an actual use case while using c++.</=
div><div><br></div><div>This is probably because I reach for c++ when seeki=
ng concrete guarantees on type safety, and python, perl or javascript when =
I&#39;m seeking type flexibility and expressiveness.</div><div><br></div><d=
iv>But it could be that I am thinking myopically. I have experimented in th=
e past with providing more &quot;script-like&quot; library objects to the o=
dd project. Again, out of curiosity more than need.=C2=A0</div><div><br></d=
iv><div>You see what I&#39;m saying? Is this in reality a fun personal proj=
ect, or is there a tangible benefit to me if I find this in the std toolbox=
?<br>=C2=A0<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 =
0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
-- <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%2Bunsubscribe@isocpp.org" target=3D=
"_blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">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/c9664ef6-f769-4942-8e44-56761d091efc%=
40isocpp.org" rel=3D"noreferrer" target=3D"_blank">https://groups.google.co=
m/a/isocpp.org/d/msgid/std-proposals/c9664ef6-f769-4942-8e44-56761d091efc%4=
0isocpp.org</a>.<br>
</blockquote></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/CALvx3haDm01D7jCvJJA3JJycraXVZ_WHz9A4=
md5h1WXhCR29cg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALvx3haDm01D7jCv=
JJA3JJycraXVZ_WHz9A4md5h1WXhCR29cg%40mail.gmail.com</a>.<br />

--00000000000032dd380571a714ce--

.
