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

People often complain about the verbosity of objective-c, but if you have a method that takes several parameters, how is

foo (a, b, c, d) memorable? You have to remember the order of parameters, and the function name rarely makes this obvious, so unless you use this func all the time, you end up reading the docs.

fooWithBarAndBlatAndFazAndFooz(a,b,c,d) makes the parameter ordering obvious, but is to me less readable than:

fooWithbar: a blat: b faz: c fooz: d

Which is just about as concise as you can get. Of course it would be "nice" if objective-c allowed for parameter order to not be meaningful, but that would require dictionaries of parameters, instead of what really happens, translation to a function with a fixed parameter list, which is pretty efficient.

Message passing syntax looking initially complex is a lazy reason to dump an entire system when the alternative has much worse integration and support.



You can't create an "easy to use" function if you name it foo and you name your variables a, b, c and d or blat or faz or whatever.

"Which is just about as concise as you can get. Of course it would be "nice" if objective-c allowed for parameter order to not be meaningful, but that would require dictionaries of parameters, instead of what really happens"

It's pretty easy for the compiler to look at the param name at the call site and compare it to what was declared. No dictionaries needed at run-time.




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

Search: