Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.

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...



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 notation is best used for properties, but I will reserve judgement until I have more than just a month of casual experience.


Indeed. 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 maybe I am a bit biased.


You realize objective-c is almost 30 years old and started as preprocessor for C?


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 melonWithNumberOfSeeds:10
                  andPriceInDollars:10];
which is a lot more self explanatory than

    new Melon(10, 10) 
That being said, for a lot of common and well known fuctions (including map, filter, reduce), Objective-C tends to be overly verbose. I think everybody is looking forward to the new literals, that will allow you to replace

    [NSDictionary dictionaryWithObjectsAndKeys:foo, @"foo",
                                               bar, @"bar",
                                               nil];
with the much more concise

    @{@"foo": foo, @"bar": bar}
Underscore.m tries to achieve something similar. I hope that people will be able see past the - granted, inconventional - syntax to focus on the actual operations done on the data structures. For example:

    // - (NSDictionary *)transformedDictionary;

    NSMutableDictionary *result = [NSMutableDictionary dictionary];
    [myDict enumerateKeysAndObjectsUsingBlock:^(id key, id obj) {
        [result setValue:[obj transformedObject]
                  forKey:key];
    }];
    return result;
vs.

    return _dict(myDict).map(^id (id key, id obj) {
            return [obj transformedObject];
        })
        .unwrap;


>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. 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...

Yes, and other people have the uninformed idiotic opition that significant whitespace sucks, or that lots of parenthesis a la Lisp suck.

Alternative syntaxes do not "suck", nor are superficial features like whitespace, brackets and parenthesis the real essence of a syntax (actually those are not even syntactical, they are lexical, and are handled by the lexer, not the parser).

Objective-C is an established language with great features for what it has to do (be dynamic and bridge low level and high level while keeping performance on par with C/C++ when needed). And it has a HUGE API library for both Mobile and Desktop.

Not to mention that it has a noble history of being the language on which both the first web browser and the first modern first person shooter were written in.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: