On Sun, Sep 08, 2013 at 02:53:10PM +0200, Dicebot wrote: > On Sunday, 8 September 2013 at 12:46:49 UTC, Gary Willoughby wrote: [...] > >Seriously, this goes against everything you learn as a programmer, > >nothing should ever be typed twice and then to say that the > >declaration and implementation could be different just boggles my > >mind?!?! Great more work! > > It is no different from overriding `interface` methods in class. > From the code structure point of view, declaration is interface. > Implementation is implementation. Keeping those separate may > sometimes/often be useful. [...]
I agree that declaration is interface, and implementation is implementation, and that it's good to separate them. What I *don't* agree with is that the interface should be *manually* maintained. There is absolutely no reason, in this day and age, that something so trivial as extracting the interface *automatically* and *reliably* by the compiler, can't be done. Therefore, the *real* solution to this problem is to fix the compiler's .di output to give a proper overview of the class *automatically*, and nicely pretty-printed. Manu has already said that the whole motivation behind wanting this sort of interface/implementation separation was to be able to tell what a class does at a glance. Well guess what? If we clean up the current messy .di generation to produce something decent, then all you have to do is to run dmd -H, and you have your at-a-glance version of the class. No unnecessary complication of the language, no maintenance nightmare, no code duplication, very little implementation effort, and 100% reliable because the .di file is generated straight from the implementation, and therefore by definition is correct. *This* is the correct solution to Manu's issue, IMO. DIP47 is approaching it from a completely wrong angle. Please, let's not go back to the C++ way. We've abandoned that a long time ago, and for good reason. That bridge should've been burned already. T -- INTEL = Only half of "intelligence".
