Denis Koroskin wrote:
On Wed, 06 May 2009 02:36:21 +0400, Christopher Wright <dhase...@gmail.com> wrote:

I see no use case for having one module in multiple files, though -- the only benefit would be private access to things defined in other files. I've never been big on making stuff private, though.

There is a use-case. Imagine you want to define a Thread class. It has a common interface, but its implementation is heavily platform-specific, and sometimes involves manual assembly.

Putting all the implementation into one file would make it very big, source code a complete mess and following it would be very hard. Instead, you may wish to define its interface in Thread.d(i), yet put its implementation in multiple files: Thread_win32.d, Thread_posix.d etc.

If that's the main concern, public import works fine, along with, optionally, an interface.

However, if there's a lot of shared code as well as a lot of platform-specific code, that's not very fun at all. Your options are to define a base class with the common code (yech) or munge all the platform-specific code together.

Reply via email to