Tuesday, January 9, 2007

Descriptors are the future

Fixed some bugs in the console of the game yesterday. After that, I implemented session specific storage. A session is created when a console is connecting to another console (or server or client in the future). Each end will create a session, and each end can use both of the sessions session-storages. Now that this is in place I realize that it must be possible to not just call methods on remote object (which is currently the only remote access possible), but also create, change and delete attributes on objects as well. This is not strictly necessary, but it will make it much easier to use the python build in attribute feature instead of creating my own custom "attribute" accessor functions on session each and every storage variables.

Luckily python can help me implement this using something called descriptors, which are rougly objects specifying how to access an attribute on an instance or class of a given class. Using these descriptors I can relay attribute creation etc. to the other end of the connection transparent to user of the api. Pretty cool i think.

This is an unexpected change, which means that other progress is delayed. But it will be worth the wait.

No comments: