5 ms·
"public class Foo extends Bar" is a lot of English text, and I have to read it all to separate out the tokens. "@interface Foo : Bar" makes it easier for me to
by reeses 14y ago
"public class Foo extends Bar" is a lot of English text, and I have to read it all to separate out the tokens. "@interface Foo : Bar" makes it easier for me to see at a glance what's going on.
I know it's a "throwaway" example in a comment, but the first example makes it quite clear what is requested. The second example, less so.
Never mind the @interface declaration. If you're going to be writing or maintaining objc, you have to understand that. However, the x : y notation often leads to confusion. Does x extend y? Does y extend x?
It's probably not a big deal for someone who lives in one or two languages, as the knowledge is refreshed frequently. However, when you swing between, say, Haskell, Python, Ruby, C++, Java, or whatever, and maybe only touch objc when you need to update your iOS app to match your web app, then there's a cognitive hurdle because ':' doesn't have a clear interpretation.
Given its Smalltalk heritage and model of message passing, "@interface y subclass: x" (or "@interface x subclasses: y") would carry less of a cognitive load while perhaps being less verbose.
Again, this is only a superficial example, but choice of names or symbols is important in the language UI.