How do you create a .di file for multiple .d files?
Jonathan M Davis
jmdavisProg at gmx.com
Tue Oct 12 18:26:31 PDT 2010
On Tuesday, October 12, 2010 18:16:04 Jesse Phillips wrote:
> Jonathan M Davis Wrote:
> > It's what Walter suggested doing to have a single std.datetime to import
> > but have multiple modules for the actual implementation (he mentioned it
> > in the datetime review thread on the Phobos list). He said to look at
> > druntime for examples, but all of the .di files that I see there appear
> > to have a single .d file corresponding to them. If there is one with
> > multiple .d files, I missed it.
> > - Jonathan M Davis
> Ah, yes. I thought you had done some big work in D, so I thought it odd you
would be confused on modules.
Yeah. I understand modules well enough (though I'm not particularly familiar
with .di files). I just screwed up in my post.
> I believe you were referring to this part from Walter:
> > Remember, if a module's implementation code is large, it can be split
> > into a .di/implementation pair, rather than into multiple modules.
> And the later follow up.
> > Jonathan M Davis wrote:
> >> Really, the ideal would be to have all of it in one module but have
> >> the code split up into several files.
> >> The closest way that I was aware to do that was to use a single module
> >> which publicly imported the others. I'll look at splitting it into an
> >> interface file and source file though.
> > druntime does it for several modules, and can serve as an example.
> I think I read into that differently. I was thinking he meant that by
> creating a D interface file you no longer have all the implementation
> making the file look big. I didn't understand the benefit, nor how it
> related to the problem.
Ah, and re-reading what he said, he wasn't suggesting that I have multiple .d
files with a single .di file but rather that I have a single .di and single .d
file. I misunderstood. That would explain why I couldn't find any code in druntime
which was splitting the implementation for a .di file into multiple files. The
public imports in the .d file might still work as I suggested though. I'll look
at using a single .d file though as see how big that is before I consider
> On another note, why does druntime ship with .di files and .d files? Phobos
> is only .d
I think that this has come up and been answered before, but unfortunately, I
don't recall what the reason was. I'd have to search through the archives to find
it. It does seem a bit odd though.
- Jonathan M Davis
More information about the Digitalmars-d-learn