> Name clashes aren't an issue, since MethodChain doesn't apply any > special meaning to the method names it knows; the limitation is > because JavaScript doesn't allow you to modify property lookup > behavior. And since we can make the chain object callable, we don't > need "fire" or "toFunction" methods.
I'm the author of MethodChain, so just thought I'd confirm the above statement. All MethodChain does is store method calls so they can later be replayed on any object. All methods in MethodChain simply add their name and arguments to an array inside the MethodChain instance, they don't implement any concrete functionality. All that's important is the names of the methods -- the object the chain is fired on will decide how to handle those calls itself, so naming clashes aren't a problem. For example: var chain = it().toLowerCase().split('-').map(function() {...}); chain.fire('my-String'); is the same as 'my-String'.toLowerCase().split('-').map(function() {...}); So split() gets called on 'my-string', map() gets called on ['my', 'string']. The methods 'fire' and 'toFunction' are a problem but I can't see any way around having them in JavaScript -- you need some way of getting the method list out of the chain object. if JavaScript had method_missing, we wouldn't need to tell MethodChain about names in advance either. -- http://mail.python.org/mailman/listinfo/python-list