June 30th, 2005
| Filed under Misc
|
Fluxus
Fluxus allows you to write Scheme scripts that create graphics live, interpreting audio and OSC input as a source of animation data. Fluxus also uses a fully featured physics library, which means you can script physical properties into objects and simulate them in realtime.
….
The built in scheme code editor runs on top of the renderer (see screenshots), which means you can edit the scripts while they are running.
June 28th, 2005
| Filed under Misc
|
Generics considered harmful
My only commentary on this is that generics are an attempt to work around the restrictions of static-typing systems. C uses void, dynamics languages just don’t have the problem. Of course weak-typing/late-binding can introduce its own problems but there are ways around that.
June 21st, 2005
| Filed under Misc
|
http://dirkgerrits.com/programming/erlisp/
I’ve been thinking about the need for this in lisp for a while, I’m glad somebody’s looking at it seriously.
June 14th, 2005
| Filed under Misc
|
I had been using a pattern similar to the Java2 event model to abstract events in the jabber client. However this proved to be rather heavyweight for Python, requiring the implementing of whole interfaces where only one or two events are needed. I'm now moving to a model more like the Gtk/Glib signal model, that hooks a named signal to functions or object members, with optional keywork parameters. The base class is simple and looks like this:
PYTHON:
-
class SignalEmitter(object):
-
def __init__(self, signals):
-
"""Base class for linking named signals to functions.
-
Initialised with a list of signals this class will emit."""
-
self._signals = {}
-
for sig in signals:
-
self._signals[sig] = []
-
-
def addReceiver(self, sig, receiver):
-
"""Add a signal receiver, throws KeyError if not available."""
-
self._signals[sig].append(receiver)
-
-
def emit(self, signal, **kwargs):
-
"""Emit a signal with keyword arguments. Throws KeyError if
-
signal not registered."""
-
for func in self._signals[signal]:
-
func(**kwargs)
A child class just registers valid signals at initialisation and them may call them with:
self.emit('signalName', keyword=val)
Interested parties just register with:
emitter.addReceiver('signalName', self.sigRcv)
This allows for a finer-grained MVC model, and makes it easier to dynamically attach interested parties at runtime.