Skip to content

Signals and Slots

December 14, 2008

I spent some time this weekend implementing a signals and slots class for haXe.   This method of event handling is often useful for managing GUI’s, since GUI control code is often defined in separate classes from GUI display code, and yet they’re very similar in terms of input/output.  Provisions/expectations of the controls and views (resp.) are often identical in terms of their parameters (Mouse moves to position X:Y…. Cursor Image moves to position X:Y, etc.).  Rather than falling back on boilerplate Event code, signals and slots let’s you stitch together relevant function calls externally from the Class(es) that define them.

The drawbacks that I’ve run into (in haXe) are that I’ve had to rely heavily on Dynamic types, which obviously can’t be checked at compile time.  Furthermore, memory leaks are problematic if you’re not careful to remove all the signal handlers.  However, I think this still would be useful in certain situations.

Check it out on google code!

From → haXe, Web Development

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: