Thread overview | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
June 20, 2005 module | ||||
---|---|---|---|---|
| ||||
What is the point of the module declaration line? Regards, James Dunne |
June 20, 2005 Re: module | ||||
---|---|---|---|---|
| ||||
Posted in reply to James Dunne | "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. |
June 20, 2005 Re: module | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | 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 |
June 20, 2005 Re: module | ||||
---|---|---|---|---|
| ||||
Posted in reply to James Dunne | 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 |
June 20, 2005 Re: module | ||||
---|---|---|---|---|
| ||||
Posted in reply to James Dunne | 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 |
June 21, 2005 Re: module | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dawid Ciężarkiewicz | 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 |
June 21, 2005 Re: module | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | 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
|
June 21, 2005 Re: module | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kevin VR | 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 |
June 22, 2005 Re: module | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | 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 |
June 25, 2005 Re: module | ||||
---|---|---|---|---|
| ||||
Posted in reply to James Dunne | "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 explicitly > 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 use > the -I switch to specify package paths to be searched if one wasn't found in the > current folder system. The module declaration is only needed if the path/file name is different from the desired package/module name. |
Copyright © 1999-2021 by the D Language Foundation