FlexSignal updated too (Re: sslot version 0.2)

Bill Baxter wbaxter at gmail.com
Fri Nov 17 15:33:19 PST 2006


Lutger wrote:
> I've uploaded a new version using the features of D since 0.173. Perhaps 
> it is useful to those who want return values and other callable types 
> than delegates from objects in their signals:
> 
> http://lutger.ifastnet.com

Sounds like good stuff, Lutger.

In the mean time, I've also updated FlexSignal to support connecting a 
function like:
    bool foo_slot(char[] s) { ... }

to the signal:
    FlexSignal!(int, char[], float);

I.e. the foo_slot can be connected to only get the char[] argument if 
that's all it's interested in.  Unfortunately the syntax for this is a 
little cumbersome right now due to bug #540:

     thesignal.fconnect!(typeof(&foo_slot),1)(&foo_slot);

When/if #540 is fixed this can become:

     thesignal.fconnect!(1)(&foo_slot);

The '1' indicates foo_slot wants to skip the 1st argument emitted by the 
signal.

Source here:
http://www.dsource.org/projects/luigi/browser/trunk/luigi/signalobj.d

Unlike Lutger's version, this is a wrapper around std.signals, and so 
signals can't have a return value.

--bb



More information about the Digitalmars-d-announce mailing list