[sigc] Re: Return values in libsigc++ 2.0
- From: Martin Schulze <martin-ml hippogriff de>
- To: tshead k-3d com
- Cc: libsigc-list gnome org
- Subject: [sigc] Re: Return values in libsigc++ 2.0
- Date: Sat, 15 May 2004 18:51:09 +0200
Hi!
First of all, sorry for the delay: my former webhoster suddenly stopped
all services including my email-accounts. It took >1 week for my domain
to get acquired by my new provider ...
Timothy M. Shead wrote:
I am evaluating what the upgrade from 1.0/1.2 to 2.0 would look like
for an existing application, and ran across one small snag. In libsigc+
+ 1.0/1.2 it was possible for a custom marshaller to specify the
default value returned when a signal doesn't have any connections. In
2.0 the behavior is to return a default-constructed object (the
accumulator object is never even created in this case). Unfortunately
in my case (slots that return bool) this is undesirable. While I could
work around this by testing signal.empty() before calling signal.emit
(), this would mean spreading some of my signal-related logic
throughout client code, and is a bit of a step backwards. Is there an
explicit mechanism for handling this, or should I derive from signal
and override emit() ?
I'm afraid I wasn't aware that this was possible in 1.2 and would not
be possible with 2.0 any more. So currently, there is no explicit
mechanism for handling this. Also, we won't want to change the default
for the case that no custom accumulator is specified for efficiency
reasons.
A solution would be transfer some code from sigc::signalN::emit() into
sigc::internal::signal_emitN::emit() which has a specialization for the
case that no accumulator is specified. The behaviour would only change
for the case that an accumulator is specified: the accumulator's
operator() would always be called like it was the case for marshallers
in 1.2. I think we could consider this as a bug fix so it could go into
libsigc++-2.0.2 which could be released in a few days time. Does this
sound like a reasonable plan?
Regards,
Martin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]