Topic: Implementation of Delegates, Revision 1,
Author: Richard Smith <richard@metafoo.co.uk>
Date: Sun, 27 Jan 2013 17:26:19 -0800
Raw View
--20cf307f34fe05070004d44f2a86
Content-Type: text/plain; charset=ISO-8859-1
This proposal seems very incomplete without a comparison to existing
language facilities (std::bind, lambdas, etc) which can accomplish many of
the same goals -- the novel feature here appears to be the comparison
operators, which you do not use in your example code. Also, your proposed
implementation's comparison operators do not work for virtual member
functions, since comparisons on those have unspecified results.
On Sat, Jan 26, 2013 at 4:17 AM, Mikhail Semenov <
mikhailsemenov1957@gmail.com> wrote:
> The proposal is to be able to create delegates, which access functions or
> member functions:
>
> create_delegate(&function)
> create_delegate(&object, &member_function)
>
> The objects produced can be compared, using == and != operators. Delegates
> are equal if they reference the same global function or they reference the
> same member in the same object.
>
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To post to this group, send email to std-proposals@isocpp.org.
> To unsubscribe from this group, send email to
> std-proposals+unsubscribe@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.
>
>
>
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To post to this group, send email to std-proposals@isocpp.org.
To unsubscribe from this group, send email to std-proposals+unsubscribe@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.
--20cf307f34fe05070004d44f2a86
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
This proposal seems very incomplete without a comparison to existing langua=
ge facilities (std::bind, lambdas, etc) which can accomplish many of the sa=
me goals -- the novel feature here appears to be the comparison operators, =
which you do not use in your example code. Also, your proposed implementati=
on's comparison operators do not work for virtual member functions, sin=
ce comparisons on those have unspecified results.<br>
<br><div class=3D"gmail_quote">On Sat, Jan 26, 2013 at 4:17 AM, Mikhail Sem=
enov <span dir=3D"ltr"><<a href=3D"mailto:mikhailsemenov1957@gmail.com" =
target=3D"_blank">mikhailsemenov1957@gmail.com</a>></span> wrote:<br><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #=
ccc solid;padding-left:1ex">
<div>The proposal is to be able to create delegates, =A0which access functi=
ons or member functions:</div><div><p align=3D"LEFT">create_delegate(&f=
unction) <br>create_delegate(&object, &member_function) <br></p><p =
align=3D"LEFT">
The objects produced can be compared, using =3D=3D and !=3D operators. Dele=
gates are equal if they reference the same global function or they referenc=
e the same member in the same object.</p><span class=3D"HOEnZb"><font color=
=3D"#888888">
<p> </p>
<font><p></p></font><p>=A0</p><p><font></font></p><font></font><p></p></fon=
t></span></div><span class=3D"HOEnZb"><font color=3D"#888888">
<p></p>
-- <br>
=A0<br>
--- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<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 unsubscribe from this group, send email to <a href=3D"mailto:std-proposa=
ls%2Bunsubscribe@isocpp.org" target=3D"_blank">std-proposals+unsubscribe@is=
ocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den" target=3D"_blank">http://groups.google.com/a/isocpp=
..org/group/std-proposals/?hl=3Den</a>.<br>
=A0<br>
=A0<br>
</font></span></blockquote></div><br>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
To unsubscribe from this group, send email to std-proposals+unsubscribe@iso=
cpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
--20cf307f34fe05070004d44f2a86--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Sun, 27 Jan 2013 19:08:47 -0800 (PST)
Raw View
------=_Part_667_22884658.1359342527738
Content-Type: text/plain; charset=ISO-8859-1
Also, I would like to see a full justification of why we need equality
testing for these things. I'm not saying that there's no reason, but I
would prefer to see the use cases spelled out.
After all, there are usually ways to get around it. For example,
Boost.Signal gets around not having equality testing by simply allowing you
to hold onto a handle that you can use to release that function from the
signal code. Would not other use cases be able to achieve the same effect?
I would like to be able to determine that.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To post to this group, send email to std-proposals@isocpp.org.
To unsubscribe from this group, send email to std-proposals+unsubscribe@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.
------=_Part_667_22884658.1359342527738
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Also, I would like to see a full justification of why we need equality test=
ing for these things. I'm not saying that there's no reason, but I would pr=
efer to see the use cases spelled out.<br><br>After all, there are usually =
ways to get around it. For example, Boost.Signal gets around not having equ=
ality testing by simply allowing you to hold onto a handle that you can use=
to release that function from the signal code. Would not other use cases b=
e able to achieve the same effect? I would like to be able to determine tha=
t.<br>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
To unsubscribe from this group, send email to std-proposals+unsubscribe@iso=
cpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
------=_Part_667_22884658.1359342527738--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Sun, 27 Jan 2013 19:11:16 -0800 (PST)
Raw View
------=_Part_94_31978818.1359342676678
Content-Type: text/plain; charset=ISO-8859-1
On Sunday, January 27, 2013 7:08:47 PM UTC-8, Nicol Bolas wrote:
>
> Also, I would like to see a full justification of why we need equality
> testing for these things. I'm not saying that there's no reason, but I
> would prefer to see the use cases spelled out.
>
> After all, there are usually ways to get around it. For example,
> Boost.Signal gets around not having equality testing by simply allowing you
> to hold onto a handle that you can use to release that function from the
> signal code. Would not other use cases be able to achieve the same effect?
> I would like to be able to determine that.
>
Indeed, this proposal, as written, has no section explaining *why* we need
it. It simply describes the feature without any justification. You should
probably look at other papers to see how they're written.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To post to this group, send email to std-proposals@isocpp.org.
To unsubscribe from this group, send email to std-proposals+unsubscribe@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.
------=_Part_94_31978818.1359342676678
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On Sunday, January 27, 2013 7:08:47 PM UTC-8, Nicol Bolas wrote:<blockquote=
class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1=
px #ccc solid;padding-left: 1ex;">Also, I would like to see a full justific=
ation of why we need equality testing for these things. I'm not saying that=
there's no reason, but I would prefer to see the use cases spelled out.<br=
><br>After all, there are usually ways to get around it. For example, Boost=
..Signal gets around not having equality testing by simply allowing you to h=
old onto a handle that you can use to release that function from the signal=
code. Would not other use cases be able to achieve the same effect? I woul=
d like to be able to determine that.<br></blockquote><div><br>Indeed, this =
proposal, as written, has no section explaining <i>why</i> we need it. It s=
imply describes the feature without any justification. You should probably =
look at other papers to see how they're written. <br></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
To unsubscribe from this group, send email to std-proposals+unsubscribe@iso=
cpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
------=_Part_94_31978818.1359342676678--
.
Author: =?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?= <mjklaim@gmail.com>
Date: Mon, 28 Jan 2013 09:03:38 +0100
Raw View
--f46d044469adf454d404d454b645
Content-Type: text/plain; charset=ISO-8859-1
On Mon, Jan 28, 2013 at 4:08 AM, Nicol Bolas <jmckesson@gmail.com> wrote:
> Also, I would like to see a full justification of why we need equality
> testing for these things. I'm not saying that there's no reason, but I
> would prefer to see the use cases spelled out.
>
> After all, there are usually ways to get around it. For example,
> Boost.Signal gets around not having equality testing by simply allowing you
> to hold onto a handle that you can use to release that function from the
> signal code. Would not other use cases be able to achieve the same effect?
> I would like to be able to determine that.
>
Boost Signals2 does allow == comparison for manual disconnect "so long as
the type of the function object has an accessible == operator."
See:
http://www.boost.org/doc/libs/1_52_0/doc/html/signals2/tutorial.html#id3299483
Which unfortunately don't help when using std::function or std::bind (and
boost equivalents).
I've implemented a lot of variants of the observer pattern and not being
able to compare std::function for removal is a huge PITA
(I do understand the problems associated though).
In particular because I'm often working with state-machine-like systems
where each state connect to some signals on beginning
and disconnect when leaving the state, so all connections are temporary.
The connection object system (that you describe) forces the observer to
hold additional data which should be unnecessary and
, I find, add a lot of code complexity just for allowing disconnection.
Joel Lamotte
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To post to this group, send email to std-proposals@isocpp.org.
To unsubscribe from this group, send email to std-proposals+unsubscribe@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.
--f46d044469adf454d404d454b645
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">=
On Mon, Jan 28, 2013 at 4:08 AM, Nicol Bolas <span dir=3D"ltr"><<a href=
=3D"mailto:jmckesson@gmail.com" target=3D"_blank">jmckesson@gmail.com</a>&g=
t;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;p=
adding-left:1ex"><div id=3D":2di">Also, I would like to see a full justific=
ation of why we need equality testing for these things. I'm not saying =
that there's no reason, but I would prefer to see the use cases spelled=
out.<br>
<br>After all, there are usually ways to get around it. For example, Boost.=
Signal gets around not having equality testing by simply allowing you to ho=
ld onto a handle that you can use to release that function from the signal =
code. Would not other use cases be able to achieve the same effect? I would=
like to be able to determine that.</div>
</blockquote></div><br>Boost Signals2 does allow =3D=3D comparison for manu=
al disconnect "<span style=3D"font-size:13px;color:rgb(0,0,0);font-fam=
ily:sans-serif;line-height:15px">so long as the type of the function object=
has an accessible=A0</span><code class=3D"" style=3D"font-size:13px;color:=
rgb(0,0,0);line-height:15px">=3D=3D</code><span style=3D"font-size:13px;col=
or:rgb(0,0,0);font-family:sans-serif;line-height:15px">=A0operator."</=
span></div>
<div class=3D"gmail_extra" style><span style=3D"font-size:13px;color:rgb(0,=
0,0);font-family:sans-serif;line-height:15px">See:=A0</span><font color=3D"=
#000000" face=3D"sans-serif"><span style=3D"line-height:15px"><a href=3D"ht=
tp://www.boost.org/doc/libs/1_52_0/doc/html/signals2/tutorial.html#id329948=
3">http://www.boost.org/doc/libs/1_52_0/doc/html/signals2/tutorial.html#id3=
299483</a></span></font></div>
<div class=3D"gmail_extra" style><font color=3D"#000000" face=3D"sans-serif=
"><span style=3D"line-height:15px">Which unfortunately don't help when =
using std::function or std::bind (and boost equivalents).</span></font></di=
v><div class=3D"gmail_extra" style>
<font color=3D"#000000" face=3D"sans-serif"><span style=3D"line-height:15px=
"><br></span></font></div><div class=3D"gmail_extra" style><font color=3D"#=
000000" face=3D"sans-serif"><span style=3D"line-height:15px">I've imple=
mented a lot of variants of the observer pattern and not being able to comp=
are std::function for removal is a huge PITA</span></font></div>
<div class=3D"gmail_extra" style><font color=3D"#000000" face=3D"sans-serif=
"><span style=3D"line-height:15px">(I do understand the problems associated=
though).</span></font></div><div class=3D"gmail_extra" style><font color=
=3D"#000000" face=3D"sans-serif"><span style=3D"line-height:15px">In partic=
ular because I'm often working with state-machine-like systems where ea=
ch state connect to some signals on beginning</span></font></div>
<div class=3D"gmail_extra" style><font color=3D"#000000" face=3D"sans-serif=
"><span style=3D"line-height:15px">and disconnect when leaving the state, s=
o all connections are temporary.</span></font></div><div class=3D"gmail_ext=
ra" style>
<font color=3D"#000000" face=3D"sans-serif"><span style=3D"line-height:15px=
">The connection object system (that you describe) forces the observer to h=
old additional data which should be unnecessary and</span></font></div><div=
class=3D"gmail_extra" style>
<font color=3D"#000000" face=3D"sans-serif"><span style=3D"line-height:15px=
">, I find, add a lot of code complexity just for allowing disconnection.</=
span></font></div><div class=3D"gmail_extra" style><font color=3D"#000000" =
face=3D"sans-serif"><span style=3D"line-height:15px"><br>
<br>Joel Lamotte<br><br></span></font></div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
To unsubscribe from this group, send email to std-proposals+unsubscribe@iso=
cpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
--f46d044469adf454d404d454b645--
.
Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Mon, 28 Jan 2013 09:23:15 +0000
Raw View
--e89a8f234d4dabb99a04d455d36f
Content-Type: text/plain; charset=ISO-8859-1
Hello Richard,
The first example contains comparisons and their results.
The main reason I introduced delegates is to provide easy features to
access members. Yes, bind will do the trick, but you have to supply
_1,_2,_3, depending on the number of parameters. As for justification of
comparison, I, personally, don't have one. Maybe sombody can help me on
that.
Regards,
Mikhail.
On 28 January 2013 01:26, Richard Smith <richard@metafoo.co.uk> wrote:
> This proposal seems very incomplete without a comparison to existing
> language facilities (std::bind, lambdas, etc) which can accomplish many of
> the same goals -- the novel feature here appears to be the comparison
> operators, which you do not use in your example code. Also, your proposed
> implementation's comparison operators do not work for virtual member
> functions, since comparisons on those have unspecified results.
>
>
> On Sat, Jan 26, 2013 at 4:17 AM, Mikhail Semenov <
> mikhailsemenov1957@gmail.com> wrote:
>
>> The proposal is to be able to create delegates, which access functions
>> or member functions:
>>
>> create_delegate(&function)
>> create_delegate(&object, &member_function)
>>
>> The objects produced can be compared, using == and != operators.
>> Delegates are equal if they reference the same global function or they
>> reference the same member in the same object.
>>
>>
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "ISO C++ Standard - Future Proposals" group.
>> To post to this group, send email to std-proposals@isocpp.org.
>> To unsubscribe from this group, send email to
>> std-proposals+unsubscribe@isocpp.org.
>> Visit this group at
>> http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.
>>
>>
>>
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To post to this group, send email to std-proposals@isocpp.org.
> To unsubscribe from this group, send email to
> std-proposals+unsubscribe@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.
>
>
>
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To post to this group, send email to std-proposals@isocpp.org.
To unsubscribe from this group, send email to std-proposals+unsubscribe@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.
--e89a8f234d4dabb99a04d455d36f
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div>Hello Richard,</div>
<div>=A0</div>
<div>The first example contains comparisons and their results.</div>
<div>The main reason I introduced delegates is to provide easy features to =
access members. Yes, bind will do the trick, but you have to supply _1,_2,_=
3, depending on the number of parameters. As for justification of compariso=
n, I, personally, don't have one. Maybe sombody can help me on that.</d=
iv>
<div>=A0</div>
<div>Regards,</div>
<div>Mikhail.<br><br></div>
<div class=3D"gmail_quote">On 28 January 2013 01:26, Richard Smith <span di=
r=3D"ltr"><<a href=3D"mailto:richard@metafoo.co.uk" target=3D"_blank">ri=
chard@metafoo.co.uk</a>></span> wrote:<br>
<blockquote style=3D"BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PA=
DDING-LEFT:1ex" class=3D"gmail_quote">This proposal seems very incomplete w=
ithout a comparison to existing language facilities (std::bind, lambdas, et=
c) which can accomplish many of the same goals -- the novel feature here ap=
pears to be the comparison operators, which you do not use in your example =
code. Also, your proposed implementation's comparison operators do not =
work for virtual member functions, since comparisons on those have unspecif=
ied results.=20
<div class=3D"HOEnZb">
<div class=3D"h5"><br><br>
<div class=3D"gmail_quote">On Sat, Jan 26, 2013 at 4:17 AM, Mikhail Semenov=
<span dir=3D"ltr"><<a href=3D"mailto:mikhailsemenov1957@gmail.com" targ=
et=3D"_blank">mikhailsemenov1957@gmail.com</a>></span> wrote:<br>
<blockquote style=3D"BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PA=
DDING-LEFT:1ex" class=3D"gmail_quote">
<div>The proposal is to be able to create delegates, =A0which access functi=
ons or member functions:</div>
<div>
<p align=3D"left">create_delegate(&function) <br>create_delegate(&o=
bject, &member_function) <br></p>
<p align=3D"left">The objects produced can be compared, using =3D=3D and !=
=3D operators. Delegates are equal if they reference the same global functi=
on or they reference the same member in the same object.</p><span><font col=
or=3D"#888888">
<p></p><font size=3D"+0">
<p></p></font>
<p>=A0</p>
<p><font size=3D"+0"></font></p><font size=3D"+0"></font>
<p></p></font></span></div><span><font color=3D"#888888">
<p></p>-- <br>=A0<br>--- <br>You received this message because you are subs=
cribed to the Google Groups "ISO C++ Standard - Future Proposals"=
group.<br>To post to this group, send email to <a href=3D"mailto:std-propo=
sals@isocpp.org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To unsubscribe from this group, send email to <a href=3D"mailto:std-proposa=
ls%2Bunsubscribe@isocpp.org" target=3D"_blank">std-proposals+unsubscribe@is=
ocpp.org</a>.<br>Visit this group at <a href=3D"http://groups.google.com/a/=
isocpp.org/group/std-proposals/?hl=3Den" target=3D"_blank">http://groups.go=
ogle.com/a/isocpp.org/group/std-proposals/?hl=3Den</a>.<br>
=A0<br>=A0<br></font></span></blockquote></div><br>
<p></p>-- <br>=A0<br>--- <br>You received this message because you are subs=
cribed to the Google Groups "ISO C++ Standard - Future Proposals"=
group.<br>To post to this group, send email to <a href=3D"mailto:std-propo=
sals@isocpp.org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To unsubscribe from this group, send email to <a href=3D"mailto:std-proposa=
ls%2Bunsubscribe@isocpp.org" target=3D"_blank">std-proposals+unsubscribe@is=
ocpp.org</a>.<br>Visit this group at <a href=3D"http://groups.google.com/a/=
isocpp.org/group/std-proposals/?hl=3Den" target=3D"_blank">http://groups.go=
ogle.com/a/isocpp.org/group/std-proposals/?hl=3Den</a>.<br>
=A0<br>=A0<br></div></div></blockquote></div><br>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
To unsubscribe from this group, send email to std-proposals+unsubscribe@iso=
cpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
--e89a8f234d4dabb99a04d455d36f--
.
Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Thu, 31 Jan 2013 21:01:52 +0000
Raw View
--e89a8fb1fac8ad50f904d49bef73
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hello Joel,
I would like to ask you: are you interested in connection/disconnection
only, which means, for example, assigning nullptr on diconnection; or do
you need comparison as well?
For example:
delegate1 =3D f1;
.....
delegate1 =3D nullptr; // on disconnection.
Do you need extra facility?
Regards,
Mikhail.
On 28 January 2013 08:03, Klaim - Jo=EBl Lamotte <mjklaim@gmail.com> wrote:
>
> On Mon, Jan 28, 2013 at 4:08 AM, Nicol Bolas <jmckesson@gmail.com> wrote:
>
>> Also, I would like to see a full justification of why we need equality
>> testing for these things. I'm not saying that there's no reason, but I
>> would prefer to see the use cases spelled out.
>>
>> After all, there are usually ways to get around it. For example,
>> Boost.Signal gets around not having equality testing by simply allowing =
you
>> to hold onto a handle that you can use to release that function from the
>> signal code. Would not other use cases be able to achieve the same effec=
t?
>> I would like to be able to determine that.
>>
>
> Boost Signals2 does allow =3D=3D comparison for manual disconnect "so lon=
g as
> the type of the function object has an accessible =3D=3D operator."
> See:
> http://www.boost.org/doc/libs/1_52_0/doc/html/signals2/tutorial.html#id32=
99483
> Which unfortunately don't help when using std::function or std::bind (and
> boost equivalents).
>
> I've implemented a lot of variants of the observer pattern and not being
> able to compare std::function for removal is a huge PITA
> (I do understand the problems associated though).
> In particular because I'm often working with state-machine-like systems
> where each state connect to some signals on beginning
> and disconnect when leaving the state, so all connections are temporary.
> The connection object system (that you describe) forces the observer to
> hold additional data which should be unnecessary and
> , I find, add a lot of code complexity just for allowing disconnection.
>
>
> Joel Lamotte
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To post to this group, send email to std-proposals@isocpp.org.
> To unsubscribe from this group, send email to
> std-proposals+unsubscribe@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=3Den.
>
>
>
--=20
---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/?hl=3Den.
--e89a8fb1fac8ad50f904d49bef73
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div>Hello Joel,</div><div>=A0</div><div>I would like to ask you: are you i=
nterested in connection/disconnection only, which means, for example, assig=
ning nullptr on diconnection; or do you need comparison as well?</div><div>
For example:</div><div>delegate1 =3D f1;</div><div>....</div><div>delegate1=
=3D nullptr; // on disconnection.</div><div>=A0</div><div>Do you need extr=
a facility?</div><div>=A0</div><div>=A0</div><div>Regards,</div><div>Mikhai=
l.</div>
<div><br><br>=A0</div><div class=3D"gmail_quote">On 28 January 2013 08:03, =
Klaim - Jo=EBl Lamotte <span dir=3D"ltr"><<a href=3D"mailto:mjklaim@gmai=
l.com" target=3D"_blank">mjklaim@gmail.com</a>></span> wrote:<br><blockq=
uote style=3D"margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:r=
gb(204,204,204);border-left-width:1px;border-left-style:solid" class=3D"gma=
il_quote">
<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"im"><br><div clas=
s=3D"gmail_quote">On Mon, Jan 28, 2013 at 4:08 AM, Nicol Bolas <span dir=3D=
"ltr"><<a href=3D"mailto:jmckesson@gmail.com" target=3D"_blank">jmckesso=
n@gmail.com</a>></span> wrote:<br>
<blockquote style=3D"margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-=
color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class=
=3D"gmail_quote"><div>Also, I would like to see a full justification of why=
we need equality testing for these things. I'm not saying that there&#=
39;s no reason, but I would prefer to see the use cases spelled out.<br>
<br>After all, there are usually ways to get around it. For example, Boost.=
Signal gets around not having equality testing by simply allowing you to ho=
ld onto a handle that you can use to release that function from the signal =
code. Would not other use cases be able to achieve the same effect? I would=
like to be able to determine that.</div>
</blockquote></div><br></div>Boost Signals2 does allow =3D=3D comparison fo=
r manual disconnect "<span style=3D"line-height:15px;font-family:sans-=
serif;font-size:13px">so long as the type of the function object has an acc=
essible=A0</span><code style=3D"line-height:15px;font-size:13px">=3D=3D</co=
de><span style=3D"line-height:15px;font-family:sans-serif;font-size:13px">=
=A0operator."</span></div>
<div class=3D"gmail_extra"><span style=3D"line-height:15px;font-family:sans=
-serif;font-size:13px">See:=A0</span><font color=3D"#000000" face=3D"sans-s=
erif"><span style=3D"line-height:15px"><a href=3D"http://www.boost.org/doc/=
libs/1_52_0/doc/html/signals2/tutorial.html#id3299483" target=3D"_blank">ht=
tp://www.boost.org/doc/libs/1_52_0/doc/html/signals2/tutorial.html#id329948=
3</a></span></font></div>
<div class=3D"gmail_extra"><font color=3D"#000000" face=3D"sans-serif"><spa=
n style=3D"line-height:15px">Which unfortunately don't help when using =
std::function or std::bind (and boost equivalents).</span></font></div><div=
class=3D"gmail_extra">
<font color=3D"#000000" face=3D"sans-serif"><span style=3D"line-height:15px=
"><br></span></font></div><div class=3D"gmail_extra"><font color=3D"#000000=
" face=3D"sans-serif"><span style=3D"line-height:15px">I've implemented=
a lot of variants of the observer pattern and not being able to compare st=
d::function for removal is a huge PITA</span></font></div>
<div class=3D"gmail_extra"><font color=3D"#000000" face=3D"sans-serif"><spa=
n style=3D"line-height:15px">(I do understand the problems associated thoug=
h).</span></font></div><div class=3D"gmail_extra"><font color=3D"#000000" f=
ace=3D"sans-serif"><span style=3D"line-height:15px">In particular because I=
'm often working with state-machine-like systems where each state conne=
ct to some signals on beginning</span></font></div>
<div class=3D"gmail_extra"><font color=3D"#000000" face=3D"sans-serif"><spa=
n style=3D"line-height:15px">and disconnect when leaving the state, so all =
connections are temporary.</span></font></div><div class=3D"gmail_extra">
<font color=3D"#000000" face=3D"sans-serif"><span style=3D"line-height:15px=
">The connection object system (that you describe) forces the observer to h=
old additional data which should be unnecessary and</span></font></div><div=
class=3D"gmail_extra">
<font color=3D"#000000" face=3D"sans-serif"><span style=3D"line-height:15px=
">, I find, add a lot of code complexity just for allowing disconnection.</=
span></font></div><div class=3D"gmail_extra"><font color=3D"#000000" face=
=3D"sans-serif"><span style=3D"line-height:15px"><br>
<br>Joel Lamotte<br><br></span></font></div></div><div class=3D"HOEnZb"><di=
v class=3D"h5">
<p></p>
-- <br>
=A0<br>
--- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<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 unsubscribe from this group, send email to <a href=3D"mailto:std-proposa=
ls%2Bunsubscribe@isocpp.org" target=3D"_blank">std-proposals+unsubscribe@is=
ocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den" target=3D"_blank">http://groups.google.com/a/isocpp=
..org/group/std-proposals/?hl=3Den</a>.<br>
=A0<br>
=A0<br>
</div></div></blockquote></div><br>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
--e89a8fb1fac8ad50f904d49bef73--
.