"Jason House" <jason.james.ho...@gmail.com> wrote in message news:iqjamt$1e5b$1...@digitalmars.com... >I wonder a bit why you want one file per object? Is it to avoid unnecessary >imports? Make finding object definitions easier? Or a style preference? I >think replies by others covered all but the first question. I use the >"import std.foo: bar, baz;" syntax for that. > > Generally speaking, separating unrelated code is a good idea, but I think > closely coupled code should go in the same file. I've heard that circular > imports are buggy in D. >
I don't think it's as bad with the newer versions of DMD as it used to be. As far as I can tell, the main problem with circular imports now is just when two modules in the cycle both have static constructors. Although there are at least known ways to work around that (there was a thread about that not too long ago, don't remember the name of it, but I was the original poster, in case that helps finding it). But yea, one-class-per-file is really a Java thing (and then a few other languages kind of ape'd it.). No need to force youself into that in D.