Many questions
Nick Sabalausky
a at a.a
Sun May 3 21:21:34 PDT 2009
"Fractal" <d294934 at bsnow.net> wrote in message
news:gtlihm$tt0$1 at digitalmars.com...
>
> The namespaces: i used them with C++, and the idea of separation between
> the uses of types, makes a very good layout. Because some namespaces
> requires more types, always i write each class in separate files. D simply
> breaks it, making a big amount of lines for imports.
>
That is easy to work around. Instead of this (which doesn't work in D):
-------------------------------------
//File: foo/fooA.d
module foo;
class fooA {}
//File: foo/fooB.d
module foo;
class fooB {}
//File: foo/fooC.d
module foo;
class fooC {}
//File: main.d
import foo;
void main() {...}
-------------------------------------
Do this:
-------------------------------------
//File: foo/fooA.d
module foo.fooA;
class fooA {}
//File: foo/fooB.d
module foo.fooB;
class fooB {}
//File: foo/fooC.d
module foo.fooC;
class fooC {}
//File: foo/all.d
module foo.all;
public import foo.fooA;
public import foo.fooB;
public import foo.fooC;
//File: main.d
import foo.all;
void main() {...}
-------------------------------------
This works fine and does exactly what you want.
Also, there are tools (rebuild, bud) that you give *just* the main file, and
they automatically find and compile all of files needed. (ie, "rebuild
main.d" instead of "cpp main.c fooA.c fooB.c...etc..."). These tools would
not be possible if D allowed you to split a module across multiple files.
> Templates: i dont use templates or mixins. they really confuses me and i
> think so that they only should be used for "array classes" or something
> similar.
>
You really should use them. If you don't, you will be writing A LOT of
duplicate code.
> Foreach ranged: it cannot be added to D1? it simplies the life, and not
> breaks any existing code
>
There are a lot of features that could be added to D1 and people want added
to D1. But that's not going to happen. That's what D2 is for. New features
go into D2. If you want the new features, you should use D2.
> Tango and Phobos: Tango is good, but the File class makes more problems
> than it solves. And i dont like the Phobos design, but I really need the
> XML... just writing other API?
>
I agree, Tango's file routines are very confusing (or maybe just the
documentation for Tango's file routines) and D1's Phobos is a mess.
Hopefully this will all improve.
More information about the Digitalmars-d
mailing list