Re:_.m: A port of Underscore.js to Objective C
by joubert on Sunday August 05, 2012 @10:09AM
(#4341459)
Shortening NSUInteger to UI is anti-ergonomic in a language used to construct UI's.
I'm also surprised that O stands for NSMutableDictionary but NSD for NSDictionary. What is an "O"?
Another thing I would argue is that using the shorter #defines for mutables would encourage their use. Instead, it might be prudent to encourage use of the immutables.
Re:_.m: A port of Underscore.js to Objective C
by kalleboo on Sunday August 05, 2012 @09:57AM
(#4341432)
I'm not sure why this guy just doesn't use MUMPS instead
Re:_.m: A port of Underscore.js to Objective C
by mikeash on Sunday August 05, 2012 @12:59PM
(#4341916)
Most of those typedefs are just silly, but the KV typedef is outright dangerous, since arrays are treated very differently from other values in C. Try returning a KV from a method and you're in for a big surprise.
A, N are typedefs of existing types.
"While JavaScript allows flexibility in variable types, Objective-C requires explicit variable types. To try to keep it brief, I tried to condense types down to the shortest name possible:
typedef BOOL B; typedef NSInteger I; typedef NSUInteger UI; typedef float F; typedef double D; typedef id KV[2]; // key-value pair
#define NSO NSObject #define A NSMutableArray #define NSA NSArray #define O NSMutableDictionary #define NSD NSDictionary #define S NSMutableString #define NSS NSString #define Date NSDate #define N NSNumber #define E NSException"
Just read that want me to stay far away from this.