3 ms·
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 b
by tubbo 14y ago
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...
- speg 14y agoI 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.
- jparishy 14y agoIndeed. 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.
- jawngee 14y agoYou realize objective-c is almost 30 years old and started as preprocessor for C?
- deleted 14y ago[deleted]
- deleted 14y ago[deleted]
- mcmatterson 14y agoI hear this sort of thing frequently, and I've never really understood it. I personally find Objective C wonderfully easy to read & understand, both in terms of interface and implementation. In fact, it's the only language other than Ruby where I frequently catch myself in moments of joy while using it. I find it hard to believe that a compiled, largely static language can feel so flexible in terms of typing and runtime, while at the same time have a strong enough type system that Clang can run the magic it does. I'm not being contradictory here, I'm genuinely curious: what in particular do people find ugly about ObjC. What languages would you appeal to for design hints in light of the needs of Objective C?
- robert-boehnke 14y agoI 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;
- batista 14y ago>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.