January 25, 2005
That got ( ModuleDeclaration md ).  Thx!

Chuck D

In article <ct3ged$1ttf$1@digitaldaemon.com>, Ben Hinkle says...
>
>
>"Charles" <no@email.com> wrote in message news:ct3fo6$1t4s$1@digitaldaemon.com...
>> > One difference is that files without a module declaration are given a module name while in Java there is no default mechanism
>>
>> Question about the frontend :
>>
>> When there is no module declaration present, the toChars() method of
>Module
>> returns garbage , strlen and strcmp dont work on it , so how can I know
>when
>> a  ( Module ) has no declared 'module foo;' ?  ( Module->ident->toChars()
>> not working either )
>>
>> Thx,
>> C
>
>It looks like the module declaration is used at line 393 of module.c in the frontend source. After parsing the module if there is a ModuleDeclaration then it uses the name from that instead of the file name. I'm not sure if this helps answer your question but I'd poke around there.
>
>As a side note the typo in the "is in multiply defined" error Jarrett was referring to is on line 416 of module.c
>
>-Ben
>
>


January 26, 2005
> I can't reproduce the difficulty you're having with it. Here's what I
have,
> which gives the expected error:

I wasn't quite clear, but in the first trial, both dtest.d and mod/mod1.d are in the command line, and the code you posted (which is what I posted) compiles and runs.  However:

"If, however, I remove mod1.d from the compiler command line, I must use import mod.mod1."

From the original post.  Sorry about that misunderstanding.


January 26, 2005
"Jarrett Billingsley" <kb3ctd2@yahoo.com> wrote in message news:ct6pol$1k1$1@digitaldaemon.com...
> > I can't reproduce the difficulty you're having with it. Here's what I
> have,
> > which gives the expected error:
>
> I wasn't quite clear, but in the first trial, both dtest.d and mod/mod1.d are in the command line, and the code you posted (which is what I posted) compiles and runs.  However:
>
> "If, however, I remove mod1.d from the compiler command line, I must use import mod.mod1."
>
> From the original post.  Sorry about that misunderstanding.

What is the exact command you are using?


January 26, 2005
> What is the exact command you are using?

...

dmd dtest.d mod/mod1.d

If I use "import mod.mod1" with that command line, I get the error

dtest.d(2): module mod1 is in multiply defined

I must use "import mod1".

IF, however, I remove mod/mod1.d from the command line, and use "import mod1", it can't find mod1.  I must use "import mod.mod1."


January 29, 2005
"Jarrett Billingsley" <kb3ctd2@yahoo.com> wrote in message news:ct950q$2tls$1@digitaldaemon.com...
> > What is the exact command you are using?
>
> ...
>
> dmd dtest.d mod/mod1.d
>
> If I use "import mod.mod1" with that command line, I get the error
>
> dtest.d(2): module mod1 is in multiply defined
>
> I must use "import mod1".
>
> IF, however, I remove mod/mod1.d from the command line, and use "import mod1", it can't find mod1.  I must use "import mod.mod1."

Ok, I see now. I'll work on it.

BTW, putting:

    module mod.mod1;

in mod\mod1.d will fix it.



February 16, 2005
On Mon, 24 Jan 2005 12:08:23 -0500, Jarrett Billingsley wrote:

> Working on a large(r) project in D, I've started to notice some.. irritation
> and clumsiness with modules.  The spec for modules is not very extensive, either.
>  So for the past day or so, I've been working on figuring out just how the
> modules work (or don't).

[snip]

I didn't see this post 'cos I was on annual leave at the time.

Here is what I've learned to do re modules ...

** I always put a module statement in each source file. The module statement states the module name and the complete package name. For example ...

  module ui.core;

** I always call a module the same name as its source file name.

** I always have the source files in the correct directory, based on the package name that is in their module statement. For example ...

The file above would be called 'core.d' it would be placed in the 'ui/' directory.

** I always give the fully specified path/file to the DMD compiler (via the
"build" utility).

** I always use "private import", though I can see myself relaxing this at odd times, if especially exceptional circumstances came up.

** I always use fully specified package and module names on the import statements.


When I do all this, I don't have problems.

BTW, the 'multiplied defined module' message is very misleading.

Hope this helps you work around D's way of doing things.


-- 
Derek
Melbourne, Australia
16/02/2005 2:53:34 PM
1 2
Next ›   Last »