The "objects" you pass around are just data structures (maps) and protocols only purpose is enforce you call legal functions on those, but without mixing the two concepts (like Python/Ruby, where each instance is a data structure that contains both private properties and pointers to method objects, and can even modify those on-the-fly). If you want to extend at 3rd party interface at runtime you still can, but it's at the protocol level rather than instance level - better than monkeypatching.
Also, works better to implement the Component-Entity-System pattern on dynamic languages, because your objects are simpler data structures, without all the memory overhead.
I believe this (defining interfaces and passing data structures around) is "OO done right" - OO is a powerful idea but it seems we're only now figuring out how to implement it.
2 comments
[ 1.7 ms ] story [ 15.5 ms ] threadThe "objects" you pass around are just data structures (maps) and protocols only purpose is enforce you call legal functions on those, but without mixing the two concepts (like Python/Ruby, where each instance is a data structure that contains both private properties and pointers to method objects, and can even modify those on-the-fly). If you want to extend at 3rd party interface at runtime you still can, but it's at the protocol level rather than instance level - better than monkeypatching.
Also, works better to implement the Component-Entity-System pattern on dynamic languages, because your objects are simpler data structures, without all the memory overhead.
I believe this (defining interfaces and passing data structures around) is "OO done right" - OO is a powerful idea but it seems we're only now figuring out how to implement it.