Hacker News new | ask | show | jobs
by upinsmoke 5066 days ago
This uses SubjectiveScript.m by same author: https://github.com/kmalakoff/SubjectiveScript.m

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.

3 comments

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.

I'm not sure why this guy just doesn't use MUMPS instead
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.