QtD 0.1 is out!

Daniel Keep daniel.keep.lists at gmail.com
Sat Feb 28 20:01:59 PST 2009



Yigal Chripun wrote:
>> On Sat, Feb 28, 2009 at 11:05 AM, Yigal Chripun<yigal100 at gmail.com> 
>> wrote:
>>> I agree with the above but there is still a small issue here:
>>> A module is a single file and when you have several large classes
>>> that are
>>> tightly coupled you can get a very big file with thousands of lines.
>>> what if
>>> i want to put each class in its own file?
>>> besides, the notion of a module is somewhat redundant - it's
>>> functionally a
>>> static struct.

You can do this with mixins or aliases.

Honestly, something I'd like to see is to extend the import syntax to
allow you to import symbols from other symbols.  For example:

> module foo;
>
> struct bar
> {
>   static void baz();
> }

> module main;
>
> import foo.bar;
>
> void main() { baz(); }

>>> this is related to D's compilation model which is copied from C/C++
>>> and it
>>> seems to me that this model is outdated. C#'s model of assemblies and
>>> metadata seems more capable. for instance there's no need for header
>>> files,
>>> that info is stored in the metadata of the assembly.

Given that D name mangling contains most if not all of a function's
interface, it sometimes makes me wonder why we can't just import a .lib
file.

Heck, stick an extra symbol on the end called _D_Interface if you must. :)

> I also think that source code organization should be orthogonal to the
> organization of the deployment executables (assemblies in .net)
> something simillar to namespaces in C#.

There are times where I hate this.  The problem is that this seems to
encourage very flat hierarchies in .NET code, with everything jammed
together.  What really exacerbates the situation is that namespaces can
be added to by any library at any time.

For example, I had some code in C#, and I couldn't for the life of me
figure out what I was supposed to link to.  Because the examples had
multiple libraries all dumping their stuff into the same namespace, it
was impossible to work out where any given symbol was coming from.

I ended up having to manually go through every goddamn library with the
object browser to figure it out.

Enforcing the module<->file thing can be annoying at times, but nowhere
near as bad as having no indication whatsoever where something is defined.

  -- Daniel


More information about the Digitalmars-d-announce mailing list