News for hackers. Stuff that matters.
Re:_.m: A port of Underscore.js to Objective C by jawngee on Saturday August 04, 2012 @09:31PM (#4340267)
What an abortion. Seriously just stop.

Every time I see someone misuse properties like this on Objective-C, I want to hire them to work at my company just so I can fire them. And then I would call them a few days later and apologize for being so rash and convince them to come back and work for me just so I could fire them again once they've settled into their desk.

Nobody wants your shitty javascript syntax mixed in with Objective-C. Nobody but you anyways. This isn't smart, regardless of whatever functionality it provides. You've done all this work to create this awkward, unclear, confusing, cryptic layer of shit that makes no sense when read. If I have to read documentation to understand what is going on, you've failed. This is full of fail.

WTF is A? N? N.I what the fuck is that?

underscorem is better for sure, but it still abuses property syntax in a way that I would reject on any project I saw its use in.

I'm always amazed at how much work people want to put into not having to write proper Objective-C. It doesn't make any sense.

So slow clap for writing some useless crap. Sorry for the vitriol, but this shit is just dumb.

Re:_.m: A port of Underscore.js to Objective C by floatingatoll on Saturday August 04, 2012 @10:51PM (#4340433)
"How dare people port X to run on Y! This has no place in production code and you are WASTING OUR TIME doing theoretical experiments!"

Saying "Sorry for the vitriol" doesn't excuse being an ass, it just confirms that you were being an ass intentionally. How is your verbal assault an appropriate response to this project?

Re:_.m: A port of Underscore.js to Objective C by mr_luc on Saturday August 04, 2012 @11:18PM (#4340482)
Well said.

The original commenter could easily have said that "This project is sacrificing readability to be terse, and I don't think it's a good tradeoff. N.I? That's not Objective-C, and I don't know anyone that would use it in production code. Interesting experiment, but I'm not impressed."

That's not how I feel; that's just an example of how I'd have expressed his sentiment.

But I don't feel that way, because I think the reasoning behind the sentiment is flawed.

If the argument is about 'wasted development effort', I understand the arguments that effort should be directed at things that benefit a community, but this isn't a project like Meteor that reinvents package management and relegates Node.js to a component in a new platform; this is just a dude writing a module of helpers.

And if the argument is that 'no one should use this in production', well, individuals who write libraries that are in tune with their own personal taste are what a website called 'Hacker News' is about.

Re:_.m: A port of Underscore.js to Objective C by jawngee on Sunday August 05, 2012 @12:04AM (#4340549)
It is because this is that offensive to anyone who writes objective-c for a living.

First of all, you are using properties to fake dot syntax for method calls. This is all kinds of wrong.

Second of all, you are shortening the names of types because you are too lazy to type the first letter and hit space. This is beyond wrong.

It's not the functionality, it's the implementation. And when writing libraries for others to use, you must consider how it fits into that surrounding code. There are a bazillion smart people working at Apple writing objective-c libraries. Have you seen anything like this? You think maybe there is a reason for that?

Its just plain lazy, its just plain offensive. Learn objective-c. It's not that hard. Stop putting in all this work to produce something to fit this idea you can get around your weird perceptions of it and to shoehorn it into what you already know.

Like I said in another post, it's sad because there seems to be a lot of work put into this.

Re:_.m: A port of Underscore.js to Objective C by sticks on Sunday August 05, 2012 @01:00AM (#4340642)

  It is because this is that offensive to anyone who writes objective-c for a living.
Really? I write objective-c for a living and I'm not finding it offensive at all. I may not agree with all of it, but rather than getting upset about it I'm trying to understand where this developer is coming from. They clearly put effort into making it, so I'll give them the benefit of the doubt that there must be some gains to be had here.

    This is all kinds of wrong.
Is it correct from the language specification's point of view? Does the compiler allow it? Does it generate correct bytecode? It seems it might not align with your code style or even widely accepted "best practices" but it's probably not all kinds of wrong. That level of rigor might be appropriate for certain environments (health care, flight control, etc) but not all software needs to be held to that standard. The reaction in this thread seems awfully similar to The Great Javascript Semicolon Wars that took place earlier this year.

  [Y]ou must consider how it fits into that surrounding code.
Perhaps this library is meant to shift the way that new code is written. Maybe it'll get some of those bazillion smart people working on other libraries to see a different way to do things.

Relax. Don't get upset. It's not meant as an affront to your style or sensibilities. Consider this by @fat [1]:

    Projects with the most radically unique styles often have the highest internal
    standards for code quality and consistency. People put so much thought into the
    written code itself that it actually engenders a new sort of pride. 
[1]: Eating a whopper: http://byfat.xxx/eating-a-whopper
Re:_.m: A port of Underscore.js to Objective C by jmduke on Sunday August 05, 2012 @12:59AM (#4340640)
It is because this is that offensive to anyone who writes objective-c for a living.

I think you need to seriously stop and consider what should and should not offend you, and what is worthy and unworthy of such vitriol.

Re:_.m: A port of Underscore.js to Objective C by mikeash on Sunday August 05, 2012 @12:58PM (#4341911)
"It is because this is that offensive to anyone who writes objective-c for a living."

Please don't pretend you speak for other people, since it's pretty clear that you don't. Speak for yourself about how you dislike it as much as you want, but don't try to pretend that you have me or other people like me on your side when you don't.

Re:_.m: A port of Underscore.js to Objective C by cageface on Sunday August 05, 2012 @12:43AM (#4340618)
This kind of internet tough guy juvenile posturing is par for the course for him. Maybe he things talking like a 14-year old bully makes him seem passionate?

I sure as hell wouldn't want him to represent any programming community in which I participate.

Re:_.m: A port of Underscore.js to Objective C by cageface on Sunday August 05, 2012 @12:29AM (#4340588)
I really can't think of any language community that's as religiously defensive as the Obj-C purists. (except for maybe the worst of the Common Lisp queens)

People try to hack Obj-C syntax because it's a verbose, clunky, awkward syntax. Ok maybe the explicitness of something like tableView:cellForRowAtIndexPath:dequeueReusableCellWithIdentifier: is OK but the syntax for blocks and anything to do with collection classes is an abomination.

Thankfully Apple has finally fixed the latter case. The next thing they need to do to reduce the stuttering is steal the var keyword from C# and introduce proper namespaces.

Re:_.m: A port of Underscore.js to Objective C by pooriaazimi on Sunday August 05, 2012 @02:39AM (#4340808)
I'm not familiar with C#, but if `var` is anything like `auto` in C++11, I think there's a good chance that they'll add it very very soon.
Re:_.m: A port of Underscore.js to Objective C by cageface on Sunday August 05, 2012 @04:39AM (#4340954)
It's pretty much the same thing. Since they already support the use of auto in Obj-C++ mode it doesn't seem like too much of a stretch, although Apple do currently caution against using auto for Obj-C variables due to some Arc issues.
Re:_.m: A port of Underscore.js to Objective C by upinsmoke on Sunday August 05, 2012 @06:20AM (#4341090)
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.

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.
Re:_.m: A port of Underscore.js to Objective C by orangecat on Sunday August 05, 2012 @12:16AM (#4340564)
Wow. Did somebody run over your dog today?
Re:_.m: A port of Underscore.js to Objective C by jawngee on Saturday August 04, 2012 @09:39PM (#4340283)
And just as a follow up, it's kind of sad because it looks like you put a lot of work in this.

But as someone who writes nothing but Objective-C (well, some C++ too) all day, every day, for a living. I would never ever use this. Mostly because it's obvious that you don't get objective-c and are trying to shoe horn some weird javascript idioms into a place where it doesn't belong.

I hate seeing wasted effort. I understand underscore provides nice functionality in javascript land and would appreciate someone taking the time to bringing similar functionality to objective-c in a way that fits and is natural with it's surrounding code.

As this is, no.

Re:_.m: A port of Underscore.js to Objective C by obituary_latte on Saturday August 04, 2012 @10:09PM (#4340343)
Can't wait to see your version.

When it does come out, I hope others can be constructive without coming across like a cunt. Nobody likes that stuff, and as we all know, it's not very helpful.

Re:_.m: A port of Underscore.js to Objective C by sirclueless on Sunday August 05, 2012 @07:40AM (#4341207)
Well, it's not his, but http://underscorem.org/ looks wayyyy cleaner. It's not the basic concept of a collection of array and hash manipulation functions that's contentious, it's the godawful syntax brought on by abbreviating all of Objective-C's types.
Re:_.m: A port of Underscore.js to Objective C by ashray on Saturday August 04, 2012 @11:51PM (#4340527)
I'm curious to know then what your take on coffee script is ?
Re:_.m: A port of Underscore.js to Objective C by joncooper on Sunday August 05, 2012 @01:06AM (#4340653)
I agree with your criticism but there's no excuse for being such a jerk. Settle down.
Re:_.m: A port of Underscore.js to Objective C by pilgrim689 on Sunday August 05, 2012 @10:05AM (#4341449)

    This isn't smart, regardless of whatever functionality it provides. You've done all this work to create this awkward, unclear, confusing, cryptic layer of shit that makes no sense when read. [...] This is full of fail.
Since when does writing in a different style deserve such verbal abuse? (people are upvotting this?!)

Open up a little and appreciate that software development has an artistic side to it. If that style has engineering drawbacks ("misuses properties" is not valid unless you explain how this misuse is bad for a codebase), then bring those up without souding profoundly deranged.

Re:_.m: A port of Underscore.js to Objective C by pjmlp on Sunday August 05, 2012 @01:18AM (#4340671)
100% with you.

I also don't understand this JavaScript everywhere.

Why can't kids learn to program in multiple languages nowadays?!

Re:_.m: A port of Underscore.js to Objective C by mikeash on Sunday August 05, 2012 @11:16AM (#4341633)
Conversely, this makes me want to abuse the language as much as possible (not like I have much room to grow, there) just so I could get a job interview from you, accept, then tell you on my starting day that I changed my mind, and string you along like that.