Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Consider changing class and interface declaration terms #32

Closed
mbaltaks opened this Issue Jul 16, 2012 · 2 comments

Comments

Projects
None yet
3 participants

This might be a silly idea, but I'll raise it anyway. I recently watched a WWDC video where Blaine Garst (WWDC 2010 Session 113 "Working Effectively with Objective-C on iPhone OS" at around 23:30) lamented the fact that because "@interface" is already used to declare a class, it is not available for declaring interfaces, which are therefore declared as "@protocol".

A new syntax for Objective-C might be the opportune place to let people declare a class with "class", and an interface with "interface". I'm not sure whether this would create less, or more confusion for existing Obj-C developers, but it would be very likely to be better for developers from any other language. Which audience is eero more targeted at?

Or there might be technical reasons that this is a bad idea.

This feels weird to me, as @interfaces are indeed interfaces and @protocols are indeed protocols.

This is mostly because they're effectively the same thing, and so it's just a matter of picking a paradigm and sticking with it. In C, of which Objective-C is a superset, the common way to provide function declarations and reliable communication mechanisms is through header files. Objective-C naturally inherits this behavior and utilizes it as a means for objective-oriented interfacing.

That makes interfaces and protocols pretty technically similar, and they really only differ in use - not functionality. Since Java and other OOP languages often don't have a concept of headers, they only require direct implementations and implementation-less "protocols", which Java calls interfaces. To switch the names would really just be making Objective-C more Java-esque for the sake of making it more Java-esque.

That being said, if eero was intended to be more familiar to other OOP programmers, then it might be the right move, but I'm unsure.

Owner

andyarvanitis commented Jul 17, 2012

It's a good question, but would propagate into many areas that I wouldn't necessarily want to change (including terminology for all the existing frameworks).

As for eero's target audience, it has definitely been current objc users. But interestingly, it has gotten some attention from those wishing to go from other languages (like Python or Ruby) to native Mac/iOS programming, but not entirely up to learning objc. I can't say if eero would help them, but it is kind of intriguing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment