digitalmars.D - module
- James Dunne (3/3) Jun 20 2005 What is the point of the module declaration line?
- Jarrett Billingsley (4/5) Jun 20 2005 It overrides the default naming scheme, which is to take the module name...
- James Dunne (6/11) Jun 20 2005 That's funny, cuz it doesn't really do that too well, last I recall... ...
- Dawid =?ISO-8859-2?Q?Ci=EA=BFarkiewicz?= (8/11) Jun 20 2005 That is why I don't use it at all. Isn't it only complicating things? I ...
- James Dunne (5/16) Jun 21 2005 I'm not alone! I agree 100%.
- Derek Parnell (10/11) Jun 20 2005 The 'module' is a scoping name. It provides a way to disambiguate public
- Kevin VR (12/25) Jun 21 2005 Ok, I was using this to define packages, but it appears that i'm doing
- Derek Parnell (11/35) Jun 21 2005 You aren't "wrong", I just meant that it is a pity that this is *the* wa...
- James Dunne (12/47) Jun 22 2005 Seems to me that I'm always enforcing my package structure in the folder
- Walter (8/17) Jun 25 2005 explicitly
- Dawid =?ISO-8859-2?Q?Ci=EA=BFarkiewicz?= (12/14) Jun 26 2005 I see the point in having filename other than module name (but this is o...
- AJG (9/23) Jun 26 2005 I have the same problem. The directory seems fixed to the namespace pref...
- James Dunne (5/32) Jun 27 2005 This is precisely the issue I was referring to, but couldn't get it down...
What is the point of the module declaration line? Regards, James Dunne
Jun 20 2005
"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.
Jun 20 2005
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...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 DunneWhat 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.
Jun 20 2005
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
Jun 20 2005
In article <d97ht5$1li1$1 digitaldaemon.com>, Dawid =?ISO-8859-2?Q?Ci=EA=BFarkiewicz?= says...James Dunne wrote:I'm not alone! I agree 100%. Regards, James DunneThat'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
Jun 21 2005
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
Jun 20 2005
Derek Parnell wrote:On Mon, 20 Jun 2005 13:04:22 +0000 (UTC), James Dunne wrote: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;"? -- KevinWhat 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.
Jun 21 2005
On Wed, 22 Jun 2005 00:02:34 +0200, Kevin VR wrote:Derek Parnell wrote: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 AMOn Mon, 20 Jun 2005 13:04:22 +0000 (UTC), James Dunne wrote: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;"?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.
Jun 21 2005
In article <1hlv2cto70qca.1pk8z0ug3ly1f.dlg 40tude.net>, Derek Parnell says...On Wed, 22 Jun 2005 00:02:34 +0200, Kevin VR wrote: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 DunneDerek Parnell wrote: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 AMOn Mon, 20 Jun 2005 13:04:22 +0000 (UTC), James Dunne wrote: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;"?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.
Jun 22 2005
"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 andexplicitlyspecify 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 justusethe -I switch to specify package paths to be searched if one wasn't foundin thecurrent folder system.The module declaration is only needed if the path/file name is different from the desired package/module name.
Jun 25 2005
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
Jun 26 2005
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
Jun 26 2005
In article <d9o1uf$udd$1 digitaldaemon.com>, AJG says...Hi there,This is precisely the issue I was referring to, but couldn't get it down in my own words. Thanks! =) Regards, James DunneI 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
Jun 27 2005