On Sun, 01 Sep 2013 16:32:06 +0200, Manu <turkey...@gmail.com> wrote:
No, actually, as much as I keep banging on the IDE thing, in this case I
absolutely don't want help from the IDE, I just want to look at my page
of
text, and be able to read a useful summary.
Can you give me any good reasons why fully defined functions polluting
the
readability of a class definition could possibly be a good thing?
I just don't get it... why would you ever want to break up the nice
summary
of what a class has&does, and why would you want to indent all of your
functions an extra few tab levels by default?
Here's something D lets you do today:
class Foo {
// Definition:
// Forbles the grabblies.
void bar();
// Implementation:
void bar() {
myGrabblies.forble();
}
}
It does not get rid of the tabs, and has no checking that all functions
are present in the definition (the compiler gets confused if only the
definition is there), but it does give a nice list at the top.
If you want the definition in a different file, and no class Foo { in the
implementation file, you can do this:
// foo.d
class Foo {
// Forbles the grabblies.
void bar();
import("foo_imp.d");
}
----------------------------
//foo_imp.d:
bar() {
myGrabblies.forble();
}
That gives no inline indication of which class the functions belong to,
though. Also, no global functions in foo_imp.d.
Now, neither of these solutions are perfect, but they might be good enough.
I'd also like to see implementation separate from definition, but I feel
dmd -H could do that job nicely by including comments, or possibly by
dmd -D with the correct ddoc template.
--
Simen