|
Archives
D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger
C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows
digitalmars.empire
digitalmars.DMDScript
|
digitalmars.D - module
↑ ↓ ← → James Dunne <james.jdunne gmail.com> writes:
What is the point of the module declaration line?
Regards,
James Dunne
↑ ↓ ← → "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"James Dunne" <james.jdunne gmail.com> wrote in message
news:d96esm$rnv$1 digitaldaemon.com...
What is the point of the module declaration line?
It overrides the default naming scheme, which is to take the module name
from the filename. Other than that, I'm not sure.
↑ ↓ ← → James Dunne <james.jdunne gmail.com> writes:
In article <d96ql7$1450$1 digitaldaemon.com>, Jarrett Billingsley says...
"James Dunne" <james.jdunne gmail.com> wrote in message
news:d96esm$rnv$1 digitaldaemon.com...
What is the point of the module declaration line?
It overrides the default naming scheme, which is to take the module name
from the filename. Other than that, I'm not sure.
That's funny, cuz it doesn't really do that too well, last I recall... Right
now, it just seems like an annoying line to change when moving a module between
packages.
Regards,
James Dunne
↑ ↓ ← → Dawid =?ISO-8859-2?Q?Ci=EA=BFarkiewicz?= <arael fov.pl> writes:
James Dunne wrote:
That's funny, cuz it doesn't really do that too well, last I recall...
Right now, it just seems like an annoying line to change when moving a
module between packages.
That is why I don't use it at all. Isn't it only complicating things? I mean
- compiler have to open all *.d files in directory, read their names and
developer has to take care about module names. Where is profit? Wouldn't be
better just to use filename without extension in lowercase everytime?
--
Dawid Ciężarkiewicz | arael
jid: arael fov.pl
↑ ↓ ← → James Dunne <james.jdunne gmail.com> writes:
In article <d97ht5$1li1$1 digitaldaemon.com>, Dawid
=?ISO-8859-2?Q?Ci=EA=BFarkiewicz?= says...
James Dunne wrote:
That's funny, cuz it doesn't really do that too well, last I recall...
Right now, it just seems like an annoying line to change when moving a
module between packages.
That is why I don't use it at all. Isn't it only complicating things? I mean
- compiler have to open all *.d files in directory, read their names and
developer has to take care about module names. Where is profit? Wouldn't be
better just to use filename without extension in lowercase everytime?
--
Dawid Ciężarkiewicz | arael
jid: arael fov.pl
I'm not alone! I agree 100%.
Regards,
James Dunne
↑ ↓ ← → Derek Parnell <derek psych.ward> writes:
On Mon, 20 Jun 2005 13:04:22 +0000 (UTC), James Dunne wrote:
What is the point of the module declaration line?
The 'module' is a scoping name. It provides a way to disambiguate public
symbols. By default, the module name is the file name and the module
declaration line is a way to override that default.
It is a pity that the module declaration also requires the package name to
be placed in it as it makes moving files a real PITA.
--
Derek Parnell
Melbourne, Australia
21/06/2005 7:42:56 AM
↑ ↓ ← → Kevin VR <save.kvr telenet.be> writes:
Derek Parnell wrote:
On Mon, 20 Jun 2005 13:04:22 +0000 (UTC), James Dunne wrote:
What is the point of the module declaration line?
The 'module' is a scoping name. It provides a way to disambiguate public
symbols. By default, the module name is the file name and the module
declaration line is a way to override that default.
It is a pity that the module declaration also requires the package name to
be placed in it as it makes moving files a real PITA.
Ok, I was using this to define packages, but it appears that i'm doing
it wrong??
I thought there is no such thing as
"package my.funky.package;"
like there is in Java, because the "package" keyword is already used as
a visibility keyword in D.
(I always found it weird why that is "package" and not "packaged", btw)
How are packages defined correctly then while not doing something like this:
"module my.funky.package.mymodule;"?
--
Kevin
↑ ↓ ← → Derek Parnell <derek psych.ward> writes:
On Wed, 22 Jun 2005 00:02:34 +0200, Kevin VR wrote:
Derek Parnell wrote:
On Mon, 20 Jun 2005 13:04:22 +0000 (UTC), James Dunne wrote:
What is the point of the module declaration line?
The 'module' is a scoping name. It provides a way to disambiguate public
symbols. By default, the module name is the file name and the module
declaration line is a way to override that default.
It is a pity that the module declaration also requires the package name to
be placed in it as it makes moving files a real PITA.
Ok, I was using this to define packages, but it appears that i'm doing
it wrong??
I thought there is no such thing as
"package my.funky.package;"
like there is in Java, because the "package" keyword is already used as
a visibility keyword in D.
(I always found it weird why that is "package" and not "packaged", btw)
How are packages defined correctly then while not doing something like this:
"module my.funky.package.mymodule;"?
You aren't "wrong", I just meant that it is a pity that this is *the* way
that package names have to be declared inside a source file. I don't have
an alternate idea though. I'm not sure why we even have to have package
names in source code. I know that it give info to the compiler about where
to find modules in the file system, but maybe that information can be
supplied by some other method.
--
Derek
Melbourne, Australia
22/06/2005 9:42:54 AM
↑ ↓ ← → James Dunne <james.jdunne gmail.com> writes:
In article <1hlv2cto70qca.1pk8z0ug3ly1f.dlg 40tude.net>, Derek Parnell says...
On Wed, 22 Jun 2005 00:02:34 +0200, Kevin VR wrote:
Derek Parnell wrote:
On Mon, 20 Jun 2005 13:04:22 +0000 (UTC), James Dunne wrote:
What is the point of the module declaration line?
The 'module' is a scoping name. It provides a way to disambiguate public
symbols. By default, the module name is the file name and the module
declaration line is a way to override that default.
It is a pity that the module declaration also requires the package name to
be placed in it as it makes moving files a real PITA.
Ok, I was using this to define packages, but it appears that i'm doing
it wrong??
I thought there is no such thing as
"package my.funky.package;"
like there is in Java, because the "package" keyword is already used as
a visibility keyword in D.
(I always found it weird why that is "package" and not "packaged", btw)
How are packages defined correctly then while not doing something like this:
"module my.funky.package.mymodule;"?
You aren't "wrong", I just meant that it is a pity that this is *the* way
that package names have to be declared inside a source file. I don't have
an alternate idea though. I'm not sure why we even have to have package
names in source code. I know that it give info to the compiler about where
to find modules in the file system, but maybe that information can be
supplied by some other method.
--
Derek
Melbourne, Australia
22/06/2005 9:42:54 AM
Seems to me that I'm always enforcing my package structure in the folder
structure on the filesystem. Then I have to duplicate effort and explicitly
specify a module keyword to tell the compiler where the module is?
Also, I don't think I've ever had a successful compile with the two being
different (where the module is stored in the filesystem and the module
identifier specified after the module keyword).
I think packages should be defined solely by the folder structure and just use
the -I switch to specify package paths to be searched if one wasn't found in the
current folder system.
Regards,
James Dunne
↑ ↓ ← → "Walter" <newshound digitalmars.com> writes:
"James Dunne" <james.jdunne gmail.com> wrote in message
news:d9c0bv$2fbn$1 digitaldaemon.com...
Seems to me that I'm always enforcing my package structure in the folder
structure on the filesystem. Then I have to duplicate effort and
specify a module keyword to tell the compiler where the module is?
No, you don't need to do that. The module declaration is optional.
Also, I don't think I've ever had a successful compile with the two being
different (where the module is stored in the filesystem and the module
identifier specified after the module keyword).
I think packages should be defined solely by the folder structure and just
the -I switch to specify package paths to be searched if one wasn't found
current folder system.
The module declaration is only needed if the path/file name is different
from the desired package/module name.
↑ ↓ ← → Dawid =?ISO-8859-2?Q?Ci=EA=BFarkiewicz?= <arael fov.pl> writes:
Walter wrote:
The module declaration is only needed if the path/file name is different
from the desired package/module name.
I see the point in having filename other than module name (but this is only
complication of things). But I can't find the way to make directory name
different from package name. Using package prefix in module declaration
leads only to problems when reorganising files. Using:
module xml.parser;
forces the dir where the file is to be named "xml". In other cases importing
of it will always fail. Renaming of "xml" dir to "xmltools" will force a
change in all files with module declaration. Did I missed something? (if
I'm wrong please someone give me an example how to do that)
--
Dawid Ciężarkiewicz | arael
↑ ↓ ← → AJG <AJG_member pathlink.com> writes:
Hi there,
I see the point in having filename other than module name (but this is only
complication of things). But I can't find the way to make directory name
different from package name. Using package prefix in module declaration
leads only to problems when reorganising files. Using:
module xml.parser;
forces the dir where the file is to be named "xml". In other cases importing
of it will always fail. Renaming of "xml" dir to "xmltools" will force a
change in all files with module declaration. Did I missed something? (if
I'm wrong please someone give me an example how to do that)
I have the same problem. The directory seems fixed to the namespace prefix. I'm
on Linux with DMD 0.126. I also agree that something should be done about it,
because it's a lot of redundant information (directory name/file name + module
declaration + import statement).
Cheers,
--AJG.
In article <d9nemm$h8q$1 digitaldaemon.com>, Dawid
=?ISO-8859-2?Q?Ci=EA=BFarkiewicz?= says...
Walter wrote:
The module declaration is only needed if the path/file name is different
from the desired package/module name.
--
Dawid Ciężarkiewicz | arael
↑ ↓ ← → James Dunne <james.jdunne gmail.com> writes:
In article <d9o1uf$udd$1 digitaldaemon.com>, AJG says...
Hi there,
I see the point in having filename other than module name (but this is only
complication of things). But I can't find the way to make directory name
different from package name. Using package prefix in module declaration
leads only to problems when reorganising files. Using:
module xml.parser;
forces the dir where the file is to be named "xml". In other cases importing
of it will always fail. Renaming of "xml" dir to "xmltools" will force a
change in all files with module declaration. Did I missed something? (if
I'm wrong please someone give me an example how to do that)
I have the same problem. The directory seems fixed to the namespace prefix. I'm
on Linux with DMD 0.126. I also agree that something should be done about it,
because it's a lot of redundant information (directory name/file name + module
declaration + import statement).
Cheers,
--AJG.
In article <d9nemm$h8q$1 digitaldaemon.com>, Dawid
=?ISO-8859-2?Q?Ci=EA=BFarkiewicz?= says...
Walter wrote:
The module declaration is only needed if the path/file name is different
from the desired package/module name.
--
Dawid Ciężarkiewicz | arael
This is precisely the issue I was referring to, but couldn't get it down in my
own words. Thanks! =)
Regards,
James Dunne
|
|