D does have modules but they have to be in separate files. (Though separate files may be better coding practice, why is it D's job to tell me how to code.)
I think a simple way to do this with existing syntax is to add functionality for `module` to be used as a block.
module modulename {
void fun(){}
}
modulename.fun();
An inline module.
