Underscore.m
Languages and libraries
functional library for objective-c
SHOW HN2012
How HN took it
2 positive, 2 neutral or asking, 0 mixed, 2 critical, out of 6 comments about the project. Thread score +0.07.
Idea: 2 for, 1 againstDesign: 0 for, 1 against
The thread, comment by comment
Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.
positive neutral or mixed critical about another commenter or something else the maker
What HN said
What people liked
Useful for developers already using underscore.js
From 1 comment
This brings to mind google's warning re: the use of functional idioms in Java: http://code.google.com/p/guava-libraries/wiki/FunctionalExplained Objective-C blocks make things…
mullr on HN
Objective-C bracket syntax is not that bad
From 2 comments
I just spent the last month learning about iOS (and Obj-C). I didn't find the square brackets that terrible. Explicit is better than implicit after all. It seems like dot…
speg on HNIndeed. Plus I think well-designed Objective-C is some of the prettiest code out there. Though I've been using it for a few years now almost exclusively (for the most part) so…
jparishy on HN
Objections
Block-based map/filter syntax is hard to read and indent
From 2 comments
I've tried that, but once you pass in blocks as arguments, the whole thing becomes a lot harder to read. I have no clue how to indent ``` [[array filter:^BOOL (id obj) { return…
robert-boehnke on HNThe blocks do make it messy but you don't need them, at least in this simple case, if you write your category to take selectors. [[array filter:@selector(passesTest)]…
xsmasher on HN
Adding methods to NSObject or categories is bad practice
From 2 comments
It should be a category on NSObject so it supports anything that supports fast enumeration which could be anything. And the indentation in the above is correct. The way you've…
jawngee on HNUh, I did read it. Yes, it's a bad idea. So is adding random things to NSObject for protocols that it does not conform to. That's actually worse, I'd argue, since you suddenly…
natesm on HN
Objective-C is verbose for common functional operations
From 1 comment
I am not saying that named arguments are a bad idea, in fact they are awesome! Often, they make code a lot more readable, consider for example ``` [UIMelon…
robert-boehnke on HN
Requests
Support any class implementing NSFastEnumeration
From 2 comments
What's the advantage of implementing map/filter as property accessors of a wrapper object instead of just doing: ``` NSArray* map(id<NSFastEnumeration> enumerable, id(^)(id…
natesm on HNIn the case of NSDictionary, Underscore.m's map iterates over objects and keys. Fast Enumeration only iterates over the dictionary's keys, when you probably want the value or…
robert-boehnke on HN
Questions
What is the advantage over plain namespaced functions
From 1 comment
What's the advantage of implementing map/filter as property accessors of a wrapper object instead of just doing: ``` NSArray* map(id<NSFastEnumeration> enumerable, id(^)(id…
natesm on HN
Alternatives named
Categories on NSArray and NSDictionary
From 1 comment
Interesting if you're already used to underscore.js. The more Objective-C way to do this, without the dot syntax and the need for wrapping, is to add categories (sets of extra…
xsmasher on HN
Underscore.js ports to Perl, Lua and ActionScript
From 2 comments
There are also ports of Underscore.js to Perl & Lua: * http://vti.github.com/underscore-perl/ * http://mirven.github.com/underscore.lua/
draegtun on HNAnd AS3, if you're into that sort of thing (self-plug): https://github.com/amacdougall/underscore.as
iron_ball on HN
Plain C functions taking NSFastEnumeration objects
From 2 comments
What's the advantage of implementing map/filter as property accessors of a wrapper object instead of just doing: ``` NSArray* map(id<NSFastEnumeration> enumerable, id(^)(id…
natesm on HNObjective-C is a superset of C, functions can be just that - a function. Especially for higher-order functions like map and filter. Not everything needs to be glued to an object.
natesm on HN