TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Underscore.js for Objective-C

120 pointsby robert-boehnkealmost 13 years ago

6 comments

mullralmost 13 years ago
This brings to mind google's warning re: the use of functional idioms in Java: <a href="http://code.google.com/p/guava-libraries/wiki/FunctionalExplained" rel="nofollow">http://code.google.com/p/guava-libraries/wiki/FunctionalExpl...</a> Objective-C blocks make things smoother than Java, but it still feels to me like the language <i>wants</i> you to have a bunch of small objects sending message to each other. (rather than doing function composition)<p>That said, I use underscore.js in nearly all of my browser and node.js code, so I'll certainly consider this when the iPhone train comes back around.
cpralmost 13 years ago
If you embrace the Smalltalk roots of Objective-C, you'll be a lot happier, and "all those braces" are completely comprehensible.
评论 #4054762 未加载
draegtunalmost 13 years ago
There are also ports of <i>Underscore.js</i> to Perl &#38; Lua:<p>* <a href="http://vti.github.com/underscore-perl/" rel="nofollow">http://vti.github.com/underscore-perl/</a><p>* <a href="http://mirven.github.com/underscore.lua/" rel="nofollow">http://mirven.github.com/underscore.lua/</a>
评论 #4054077 未加载
xsmasheralmost 13 years ago
Interesting if you're already used to underscore.js.<p>The more Objective-C way to do this, without the dot syntax and the need for wrapping, is to add categories (sets of extra methods) to the NSArray and NSDictionary classes.<p>The square brackets don't impair chaining in any way - you can still [[[myDict allKeys] filter:filterMethod] invoke: invokeMethod]
评论 #4053624 未加载
natesmalmost 13 years ago
What's the advantage of implementing map/filter as property accessors of a wrapper object instead of just doing:<p><pre><code> NSArray* map(id&#60;NSFastEnumeration&#62; enumerable, id(^)(id object) block); </code></pre> ?<p>Obviously, you'd still want to have a prefix of some sort for namespacing.
评论 #4054188 未加载
tubboalmost 13 years ago
It's cool that we have an Underscore for Obj-C now, but I'm really excited about this because of the project's opinion that bracket syntax sucks.<p>It's always been a curiosity that a company like Apple, who prides themselves on making great user interfaces can't even get it together to make a programming language that's nice to look at. They seem to care about everyone BUT their own kind these days...
评论 #4053685 未加载
评论 #4053719 未加载
评论 #4054311 未加载
评论 #4053827 未加载
评论 #4054659 未加载
评论 #4053833 未加载
评论 #4053831 未加载