Sunday, November 8, 2009

Immutable objects

or, more importantly, prototypes.

I'm grappling with the idea of moving objects between contexts. There are security issues (don't want people to change the root prototypes for all contexts within the whole OS - like smalltalk does) and performance issues (if we're using PIC then we want to use the same parents for as much as possible - so the PIC can do quick comparisons to determine which branch to take).

The only thing I've come up with is some sort of immutable object. If the prototype for an object is immutable then the parent id for that object is never going to change, and you can't update the prototype to cause security problems.

This fixes the above two concerns, at the expense of not being able to add your own useful functions to existing objects (like rails does to pretty much everything...). You can manually do this, at some speed expense, by using an intermediate prototype of your own making - all new leaves extend from this, with it's new functions.

This would break all PIC for inter-context communication, but that's your choice.

No comments:

Post a Comment