Re: really why module declarations?

2017-03-26 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, March 26, 2017 20:51:01 XavierAP via Digitalmars-d-learn wrote: > I've perused both the spec[1] and Andrei's book, and I the idea I > get is that module declarations are optional, recommended only in > case of file names not being valid D names. But in the community > (and Phobos) I see

Re: really why module declarations?

2017-03-26 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 26 March 2017 at 22:10:07 UTC, XavierAP wrote: I was curious but I guess it's long to explain the different things that can go wrong if one doesn't declare module names. You'll just get a name conflict eventually. Either two modules with the same name, or "module `foo` must be

Re: really why module declarations?

2017-03-26 Thread XavierAP via Digitalmars-d-learn
On Sunday, 26 March 2017 at 20:58:24 UTC, Adam D. Ruppe wrote: Module declarations are only optional in the most trivial case that is rarely useful in real world code. I recommend you ALWAYS use them (and always put a ddoc comment on them!), and moreover that you avoid top name modules (use

Re: really why module declarations?

2017-03-26 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 26 March 2017 at 20:51:01 UTC, XavierAP wrote: I've perused both the spec[1] and Andrei's book, and I the idea I get is that module declarations are optional, recommended only in case of file names not being valid D names. Module declarations are only optional in the most trivial

really why module declarations?

2017-03-26 Thread XavierAP via Digitalmars-d-learn
I've perused both the spec[1] and Andrei's book, and I the idea I get is that module declarations are optional, recommended only in case of file names not being valid D names. But in the community (and Phobos) I see it's strongly recommended and used throughout. What's the reason? If the