4 ms·
How is it worse?
by bwindels 13y ago
How is it worse?
- K0nserv 13y agoSeparation of interfaces and implementation is a core component of pre compiled code distribution, .h files + compiled library. By simply glancing over a header file one can achieve a quick idea of the interface without consulting the documentation. It's self documenting, reading a Java file in the same way is impossible. Forward declaration in header files and imports in implementation is also a huge benefit in compilation speed and complexity.
- frou_dh 13y agoThe point is that writing and maintaining such files by hand is a tremendous waste of time. When I last used C#, I remember Visual Studio would extract and display such public overviews directly from compiled .NET assemblies. Even if no IDE is involved, something could just auto-generate a text file for distribution. It could even be adorned with a .h file extension for faux-retro appearance!
- K0nserv 13y agoI do agree partially about the repetition issue, but with a language such as Objective-C you'll auto complete every definition the second time which hardly takes a second, especially with fuzzy auto completion. If time saving is the goal the naming convention for methods is a far better candidate for change
- frou_dh 13y agoZapping the entirety of an unnecessarily manual practice is going to be objectively better than providing some typing assistance for it.
- K0nserv 13y agoThere are still use cases for header files which would require additional syntax if headers are to be generated from .m files. Also the use case of forward declaration comes to mind which would totally lost with an implementation only system
- frou_dh 13y agoThere is no .m .h .c .cpp involved. In hypothetical new language we cast off all baggage and stop thinking in archaic C and "C with a twist" terms.
- to3m 13y agoYou wouldn't need any of this if it were done properly. C# is a good demonstration of the principle and I'm sure Java could support something similar. In the case of C#, forward declarations are unnecessary, and if you want/need to see something like a .h file then one can be generated automatically from the metadata included in the binary. In fact Objective-C already includes pretty much everything necessary in the binary already, as you can see by using class-dump. Perhaps additional work would be required to support exposing absolutely everything that might be required, but there's no obvious reason why the language couldn't be extended to allow direct use of compiled code, with no need for a .h file.
- rossjudson 13y agoThat's what javadoc is for. You get a lot more out of browsing through that, than header files.
- pjmlp 13y ago- Turbo Pascal - Object Pascal - Delphi - Modula-2 - Modula-3 - Oberon - Active Oberon - Component Pascal - OCaml - Haskell - D - Ada - Eiffel - ... All languages with native code compiler available, where the header files can bot the manually or automatically generated from the implementation. Many of them have, or used to have, code browsers and auto complete by reading the metadata stored in the binaries. C based toolchains are still at stone age, in terms of modular programming support.