robb/Underscore.m — pull request #13 by kmalakoff (2012-07-15 00:26:38+00:00)
Title: Wrapped library with familiar _.function convention.

Hi Robert,

Yesterday, I went looking for an objective-C implementation of underscore and found yours! I have very impressed with the amazing property trick for implementing .functionName syntax.

However, felt the syntax and forced chaining could a little unconventional in the sense that I believe an Underscore.js user would just want something identical as much as possible. So I wrapped your library using the _.function convention and I added _,indexOf and _.defer because I was using them in my own library.

A few thoughts:

1) As an optimization, I copied some common code to the _.functionName implementation. Obviously having duplicate code is not great, but I wanted to avoid unnecessary collection copying through the Wrappers. Maybe someone in the community can review this for more optimizations (maybe some implementations belong in the Wrappers and some in the _.functionName).

2) I was originally trying to store _ in an extern rather than as a singleton, but couldn't get it to work. If you have any ideas to do that to avoid the extra [Underscore sharedInstance] calls, please do!

3) I ended up removing some of your '- (id)init __deprecated;' for the singleton to create an instance. Hopefully that is the best approach.

I hope you accept this pull request!

Kevin