220 31431 <2EDD5373-2876-4B4C-9B68-DFA855DE4007@gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Bryce Glover <randomdsdevel@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: P0534: call/cc, type safety and exceptions
Date: Sat, 4 Mar 2017 20:38:24 -0500
Lines: 204
Approved: news@gmane.org
Message-ID: <2EDD5373-2876-4B4C-9B68-DFA855DE4007@gmail.com>
References: <26EDCD88-C4FB-47F3-BF21-38D980966CA8@gmail.com> <45450312-284d-3eab-a196-826dedbf0abd@beamways.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\))
Content-Type: multipart/alternative; boundary="Apple-Mail=_C43991DF-3C34-484D-8B0F-F584F6836B5F"
X-Trace: blaine.gmane.org 1488677913 18526 195.159.176.226 (5 Mar 2017 01:38:33 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sun, 5 Mar 2017 01:38:33 +0000 (UTC)
Cc: std-proposals@isocpp.org
To: Bengt Gustafsson <bengt.gustafsson@beamways.com>
Original-X-From: std-proposals+bncBCPMBF5ZZEBBBFGY5XCQKGQEKSJT4WQ@isocpp.org Sun Mar 05 02:38:27 2017
Return-path: <std-proposals+bncBCPMBF5ZZEBBBFGY5XCQKGQEKSJT4WQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw0-f198.google.com ([209.85.161.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCPMBF5ZZEBBBFGY5XCQKGQEKSJT4WQ@isocpp.org>)
	id 1ckL7v-0003n5-TJ
	for gclcip-std-proposals@m.gmane.org; Sun, 05 Mar 2017 02:38:24 +0100
Original-Received: by mail-yw0-f198.google.com with SMTP id 203sf244653710ywz.2
        for <gclcip-std-proposals@m.gmane.org>; Sat, 04 Mar 2017 17:38:30 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=from:mime-version:subject:in-reply-to:date:cc:message-id:references
         :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=whxZsApNMsQrmeUxYi61gVF1O7UPPGPl0DAqwL9b8wU=;
        b=nbopSztMBdBTCZuwuXEqtd8AJa0FEu8Yo2LMV7e2ZM4k9di7gvAzu49O0/AJwRcROH
         tR8qdJyC0o8gXEbu5HtIdFBJ2r43rT4tzprrWP3GmYC9okc7s5zeWFp6xwPxDbFUqij7
         ArOI7ai1iBT1PmjbtaQ1n70qiY2JvSVkH1iGhpmnO5+aeU3XMv9aSdcJOlxefyNN9MOa
         KCCwdgPgtj0J5sfA1NFUbxL4KpBKpSxpQgLBZmNtsyYmV4EUV24jTj96BqPKM3r61epC
         2LntXEKqLOspLiMibYId0e7udsW9drRuyauJ4bwfFS08El4LswhZ+BPN/nA22U3rr+pW
         Lz4A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:from:mime-version:subject:in-reply-to:date:cc
         :message-id:references: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=whxZsApNMsQrmeUxYi61gVF1O7UPPGPl0DAqwL9b8wU=;
        b=g36Rox7SnZCdaDDznIqEAfFUx5icb7v625Jm6xPYJrp86PqnC4HGyXpcV6FOa9hsgo
         IPBte3FI11LLEQz3FRsVyQUbXpABDZm1k1ZwWZ8O7yB/XFxQ/r5vh+oQbTVw+lTiYnsS
         9pnx7vNLmJY5pH+//WivYfIdutLyXduXOtxQpBnQRJeEFUKSQThEWuj5w1RXVgyEmPvy
         HbMUnRMzRpPpdsqhLKq6EgUW6FBJvSCpIrJeDz8+vYl2LaoAc+4Npo2SDL+3pInwkeO7
         9ZbqC7nRlQnX0gO9psoo/V70xBLD8pywDoRxU4q4RSJQpf1+mR2Xdx6m4d1nxds2Z42R
         eT7A==
X-Gm-Message-State: AMke39ngylAfWhe0UDjrYxFcyx5/QadndrRq2rp3wA/qY+uK9WnIVpiuhC2iNa/2BIodWA==
X-Received: by 10.129.112.131 with SMTP id l125mr3738434ywc.85.1488677909612;
        Sat, 04 Mar 2017 17:38:29 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.36.2.76 with SMTP id 73ls1632974itu.13.gmail; Sat, 04 Mar 2017
 17:38:27 -0800 (PST)
X-Received: by 10.107.5.213 with SMTP id 204mr8501683iof.189.1488677907898;
        Sat, 04 Mar 2017 17:38:27 -0800 (PST)
Original-Received: from mail-it0-x242.google.com (mail-it0-x242.google.com. [2607:f8b0:4001:c0b::242])
        by mx.google.com with ESMTPS id b184si198446iti.119.2017.03.04.17.38.27
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sat, 04 Mar 2017 17:38:27 -0800 (PST)
Received-SPF: pass (google.com: domain of randomdsdevel@gmail.com designates 2607:f8b0:4001:c0b::242 as permitted sender) client-ip=2607:f8b0:4001:c0b::242;
Original-Received: by mail-it0-x242.google.com with SMTP id 68so6206433itg.0
        for <std-proposals@isocpp.org>; Sat, 04 Mar 2017 17:38:27 -0800 (PST)
X-Received: by 10.36.208.134 with SMTP id m128mr9391930itg.44.1488677907666;
        Sat, 04 Mar 2017 17:38:27 -0800 (PST)
Original-Received: from [10.0.1.11] (c-68-50-177-220.hsd1.in.comcast.net. [68.50.177.220])
        by smtp.gmail.com with ESMTPSA id m125sm6481234iom.38.2017.03.04.17.38.26
        (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
        Sat, 04 Mar 2017 17:38:26 -0800 (PST)
In-Reply-To: <45450312-284d-3eab-a196-826dedbf0abd@beamways.com>
X-Mailer: Apple Mail (2.3124)
X-Original-Sender: RandomDSdevel@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of
 randomdsdevel@gmail.com designates 2607:f8b0:4001:c0b::242 as permitted
 sender) smtp.mailfrom=randomdsdevel@gmail.com;       dmarc=pass (p=NONE
 sp=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:31431
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/31431>


--Apple-Mail=_C43991DF-3C34-484D-8B0F-F584F6836B5F
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8

> On Mar 3, 2017, at 7:36 AM, Bengt Gustafsson <bengt.gustafsson@beamways.c=
om> wrote:
> I don't know what you mean by trampoline in this context. I checked wikip=
edia link but I didn't get it...
>=20
> =E2=80=A6

     Yeah, sorry, that article=E2=80=99s not as descriptive as one would ho=
pe, is it?  Maybe this StackOverflow question <http://stackoverflow.com/que=
stions/189725/what-is-a-trampoline-function> will help you understand what =
I was trying to convey, or perhaps I was just confusing the idea of a tramp=
oline with the similar concepts of thunks <https://en.wikipedia.org/wiki/Th=
unk> and/or shims <https://en.wikipedia.org/wiki/Shim_(computing)>.  The ex=
ample I usually tend to think of is the Objective-C run-time library=E2=80=
=99s `objc_msgSend()` function (which I=E2=80=99ve found <https://www.googl=
e.com/search?client=3Dsafari&rls=3Den&q=3DIs+objc_msgSend()+a+trampoline?&i=
e=3DUTF-8&oe=3DUTF-8> is referred to as a trampoline) due to my rudimentary=
 familiarity with Apple platforms, but I=E2=80=99m not sure how helpful tha=
t might be to you=E2=80=A6

> =E2=80=A6
>=20
> This aside, do you see a reason for this being a tag type and operator() =
rather than a method call?
>=20
> =E2=80=A6


Honestly, I don=E2=80=99t have enough of an opinion on or enough stake in t=
his argument to care all that much either way.  I just see continuations as=
 an interesting construct that I might use some time in the future. =20

> =E2=80=A6
>=20
> I thought about this more and it seems that it may have to do with implem=
enting a fiber pool. The invoked function is the body of the next fiber to =
execute on the stack of the continuation and the target of the ccllcc is ju=
st a function like this:
>=20
> void fiber_base(continuation&& cont, bool& stop)
> {
>    continuation c =3D std::move(cont);
>    while (!stop)
>        c =3D c();
> }
>=20
> then the party starting the fiber_base with callcc can invoke anything on=
 this stack and when this anything returns the loop goes back to wait for t=
he next task.
>=20
> This idea is just speculation on my part, but it seems to show a use case=
 (unless the stack itself is made a first class object which can be reused =
for multiple callcc calls which I would find more logical).=20
>=20
> =E2=80=A6


That=E2=80=99s another way of looking at it, I suppose=E2=80=A6

=E2=80=94=E2=80=89Bryce Glover
=E3=80=80=E2=80=89RandomDSdevel@gmail.com

> =E2=80=A6
>=20
> Den 2017-03-02 kl. 23:21, skrev Bryce Glover:
>> (snipped=E2=80=A6)
> --=20
> Bengt Gustafsson
> CEO, Beamways AB
> Westmansgatan 37
> 582 16 Link=C3=B6ping, Sweden
> +46 (705) 338259
> Skype: benke_g
> www.beamways.com <http://www.beamways.com/>

--=20
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 e=
mail 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/2EDD5373-2876-4B4C-9B68-DFA855DE4007%40gmail.com=
..

--Apple-Mail=_C43991DF-3C34-484D-8B0F-F584F6836B5F
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><div><blockquote t=
ype=3D"cite" class=3D""><div class=3D"">On Mar 3, 2017, at 7:36 AM, Bengt G=
ustafsson &lt;<a href=3D"mailto:bengt.gustafsson@beamways.com" class=3D"">b=
engt.gustafsson@beamways.com</a>&gt; wrote:</div><div class=3D"">
 =20
    <meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
" class=3D"">
 =20
  <div bgcolor=3D"#FFFFFF" text=3D"#000000" class=3D""><p class=3D"">I don'=
t know what you mean by trampoline in this context. I
      checked wikipedia link but I didn't get it...</p><div class=3D"">=E2=
=80=A6</div></div></div></blockquote><div><br class=3D""></div><div>&nbsp; =
&nbsp; &nbsp;Yeah, sorry, that article=E2=80=99s not as descriptive as one =
would hope, is it? &nbsp;Maybe&nbsp;<a href=3D"http://stackoverflow.com/que=
stions/189725/what-is-a-trampoline-function" class=3D"">this StackOverflow =
question</a>&nbsp;will help you understand what I was trying to convey, or =
perhaps I was just confusing the idea of a trampoline with the similar conc=
epts of&nbsp;<a href=3D"https://en.wikipedia.org/wiki/Thunk" class=3D"">thu=
nks</a>&nbsp;and/or&nbsp;<a href=3D"https://en.wikipedia.org/wiki/Shim_(com=
puting)" class=3D"">shims</a>. &nbsp;The example I usually tend to think of=
 is the Objective-C run-time library=E2=80=99s `objc_msgSend()` function (w=
hich I=E2=80=99ve&nbsp;<a href=3D"https://www.google.com/search?client=3Dsa=
fari&amp;rls=3Den&amp;q=3DIs+objc_msgSend()+a+trampoline?&amp;ie=3DUTF-8&am=
p;oe=3DUTF-8" class=3D"">found</a>&nbsp;is referred to as a trampoline) due=
 to my rudimentary familiarity with Apple platforms, but I=E2=80=99m not su=
re how helpful that might be to you=E2=80=A6</div><div><br class=3D""></div=
><blockquote type=3D"cite" class=3D"">=E2=80=A6</blockquote><blockquote typ=
e=3D"cite" class=3D""><br class=3D""></blockquote><blockquote type=3D"cite"=
 class=3D"">This aside, do you see a reason for this being a tag type and
      operator() rather than a method call?</blockquote><div><blockquote ty=
pe=3D"cite" class=3D""><br class=3D""></blockquote><blockquote type=3D"cite=
" class=3D"">=E2=80=A6</blockquote></div><div><br class=3D""></div><div>Hon=
estly, I don=E2=80=99t have enough of an opinion on or enough stake in this=
 argument to care all that much either way. &nbsp;I just see continuations =
as an interesting construct that I might use some time in the future. &nbsp=
;</div><div><br class=3D""></div><blockquote type=3D"cite" class=3D"">=E2=
=80=A6</blockquote><blockquote type=3D"cite" class=3D""><br class=3D""></bl=
ockquote><blockquote type=3D"cite" class=3D"">I thought about this more and=
 it seems that it may have to do
      with implementing a fiber pool. The invoked function is the body
      of the next fiber to execute on the stack of the continuation and
      the target of the ccllcc is just a function like this:</blockquote><b=
lockquote type=3D"cite" class=3D""><br class=3D""></blockquote><blockquote =
type=3D"cite" class=3D"">void fiber_base(continuation&amp;&amp; cont, bool&=
amp; stop)</blockquote><blockquote type=3D"cite" class=3D"">{</blockquote><=
blockquote type=3D"cite" class=3D""> &nbsp; &nbsp;continuation c =3D std::m=
ove(cont);</blockquote><blockquote type=3D"cite" class=3D""> &nbsp; &nbsp;w=
hile (!stop)</blockquote><blockquote type=3D"cite" class=3D""> &nbsp; &nbsp=
; &nbsp; &nbsp;c =3D c();</blockquote><blockquote type=3D"cite" class=3D"">=
}</blockquote><blockquote type=3D"cite" class=3D""><br class=3D""></blockqu=
ote><blockquote type=3D"cite" class=3D"">then the party starting the fiber_=
base with callcc can invoke
      anything on this stack and when this anything returns the loop
      goes back to wait for the next task.</blockquote><blockquote type=3D"=
cite" class=3D""><br class=3D""></blockquote><blockquote type=3D"cite" clas=
s=3D"">This idea is just speculation on my part, but it seems to show a
      use case (unless the stack itself is made a first class object
      which can be reused for multiple callcc calls which I would find
      more logical).&nbsp;</blockquote><div><blockquote type=3D"cite" class=
=3D""><br class=3D""></blockquote><blockquote type=3D"cite" class=3D"">=E2=
=80=A6</blockquote></div><div><br class=3D""></div><div>That=E2=80=99s anot=
her way of looking at it, I suppose=E2=80=A6</div><div><br class=3D""></div=
><div><div class=3D"">=E2=80=94=E2=80=89Bryce Glover</div><div class=3D"">=
=E3=80=80=E2=80=89<a href=3D"mailto:RandomDSdevel@gmail.com" class=3D"">Ran=
domDSdevel@gmail.com</a></div></div><div><br class=3D""></div><blockquote t=
ype=3D"cite" class=3D"">=E2=80=A6</blockquote><blockquote type=3D"cite" cla=
ss=3D""><br class=3D""></blockquote><blockquote type=3D"cite" class=3D""><d=
iv bgcolor=3D"#FFFFFF" text=3D"#000000" class=3D"">
    <div class=3D"moz-cite-prefix">Den 2017-03-02 kl. 23:21, skrev Bryce
      Glover:<br class=3D"">
    </div>
    <blockquote cite=3D"mid:26EDCD88-C4FB-47F3-BF21-38D980966CA8@gmail.com"=
 type=3D"cite" class=3D""><font color=3D"#222222" face=3D"Arial, Helvetica,=
 sans-serif" size=3D"2" class=3D""><span style=3D"background-color: rgb(255=
, 255, 255);" class=3D"">(snipped=E2=80=A6)</span></font><div style=3D"marg=
in: 0px; padding: 0px; border: 0px; color: rgb(34,
        34, 34); font-family: Arial, Helvetica, sans-serif; font-size:
        13px;" class=3D"">
      </div>
    </blockquote>
    <pre class=3D"moz-signature" cols=3D"72">--=20
Bengt Gustafsson
CEO, Beamways AB
Westmansgatan 37
582 16 Link=C3=B6ping, Sweden
+46 (705) 338259
Skype: benke_g
<a class=3D"moz-txt-link-abbreviated" href=3D"http://www.beamways.com/">www=
..beamways.com</a></pre></div></blockquote></div></body></html>

<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/2EDD5373-2876-4B4C-9B68-DFA855DE4007%=
40gmail.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/2EDD5373-2876-4B4C-9B68-DFA855DE4007%=
40gmail.com</a>.<br />

--Apple-Mail=_C43991DF-3C34-484D-8B0F-F584F6836B5F--

.
