Hacker News new | past | comments | ask | show | jobs | submit login

Since Obj-C messaging supports duck typing, I'm not sure I understand the argument you're making against the syntax.



I believe dguaraglia is talking about the types of arguments, which are often included in the method name. So you get things like [guy eatFood:food withHand:hand usingEatingStyle:eatingStyle]. Overall, it lends itself to exceptionally long lines of code, such that Objective-C message sends are often broken into multiple lines with lots of info on the right side of the window. For example, instead of:

  NSWindow *window = [[NSWindow alloc] initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation screen:(NSScreen *)screen];
people will often write write:

  NSWindow *window = [[NSWindow alloc] initWithContentRect: desiredRect
                                                 styleMask: windowStyle
                                                   backing: NSBackingStoreBuffered
                                                     defer: YES
                                                    screen: [NSScreen mainScreen]];
The length of the selector requires us to choose how we're going to write this line of code.


I might have talked out of my ass? Wouldn't be the first time, and I apologize if I did.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: