On Monday, 2 September 2013 at 12:54:41 UTC, Simen Kjaeraas wrote:
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.
That is pretty fun trick but it is so preprocessor-flavored! :(
Also it is likely to confuse lot of semantic analysis tool. Still
may be a viable hack.