eerolanguage / eero

Eero was a fully binary- and header-compatible dialect of Objective-C, implemented with a modified version of the Apple-sponsored LLVM/clang open-source compiler. It featured a streamlined syntax, Python-like indentation, and other features that improve readability and code safety. It was inspired by languages such as Smalltalk, Python, and Ruby.
https://web.archive.org/web/20171101134337/http://eerolanguage.org/
288 stars 7 forks source link

Request: Derive Interface from Implementation #21

Open jockm opened 12 years ago

jockm commented 12 years ago

With the cause of reducing redundancy and the pain points of Objective-C I would like to request the following feature:

The interface section should be optional, and synthesized from the implementation — just like in Java, Ruby, Python, and most modern languages. The Implementation contains all the information needed to derive the Interface in all cases except when manifest constants (or the like) need to be declared.

andyarvanitis commented 12 years ago

Agree whole-heartedly with this -- it was a stretch-goal which I investigated but didn't get in for the re-launch. I still like the idea, so keeping this ticket open.

pieteromvlee commented 12 years ago

Disagree. I like that I can glance headers and see how to use this class. If I have to skim an implementation file it's not clear at all what the primary methods are and which are the helpers

andyarvanitis commented 12 years ago

Well, I probably should have been clearer in my initial response to this feature request, so I'll try to do so now.

Since the goal of this project is not to stray semantically from Objective-C, this sort of change would not remove the need for headers completely (or even for most cases). I see this as useful for internal or "helper" classes within an implementation source file. You would still need header files for any class that any other entity uses.

Of course you could also use this with a protocol and some sort of factory pattern, and it would at least remove the need for an empty interface in the source file. But it would still mean you need a protocol header file.

This feature would also likely require a new syntax. Maybe something like:

private class MyClass : Object
...
end