digitalmars.D - [OT] modules vs filenames in "module-name == filename" package systems
- Nick Sabalausky (9/9) Jun 29 2010 In a language that has a package system that forces package names to be ...
- Todd VanderVeen (5/14) Jun 29 2010 Java supports mobile code. Class loaders can resolve code over the netwo...
- Todd VanderVeen (3/17) Jun 29 2010 That should read "not only against relative filesystem". Obviously, it c...
- Steven Schveighoffer (13/23) Jun 29 2010 Java doesn't import source files, it imports compiled objects. Therefor...
- Todd VanderVeen (6/29) Jun 29 2010 Java Class loaders observe the JVM class file format. This format in tur...
- Todd VanderVeen (10/39) Jun 29 2010 Steve,
- Bruno Medeiros (11/20) Jul 08 2010 "forcibly disallowing absolute paths when importing"
In a language that has a package system that forces package names to be the same as the directory name, and module names to be the same the file name (Such as Java, but not D): What is the point of having packages/modules instead of just simply importing by a relative filepath? Is it just so that it's consistent with refering to a symbol by it's fully-qualified name, or forcibly disallowing absolute paths when importing, or are there other reasons? ------------------------------- Not sent from an iPhone.
Jun 29 2010
== Quote from Nick Sabalausky (a a.a)'s articleIn a language that has a package system that forces package names to be the same as the directory name, and module names to be the same the file name (Such as Java, but not D): What is the point of having packages/modules instead of just simply importing by a relative filepath? Is it just so that it's consistent with refering to a symbol by it's fully-qualified name, or forcibly disallowing absolute paths when importing, or are there other reasons? ------------------------------- Not sent from an iPhone.Java supports mobile code. Class loaders can resolve code over the network, not against a relative filesystem. The Java package naming convention is based on a reversed URL for an organization (e.g. com.myorg.whatever), which is presumably unique. It servers as a namespace mechanism.
Jun 29 2010
== Quote from Todd VanderVeen (tdv part.net)'s article== Quote from Nick Sabalausky (a a.a)'s articleThat should read "not only against relative filesystem". Obviously, it can do this too.In a language that has a package system that forces package names to be the same as the directory name, and module names to be the same the file name (Such as Java, but not D): What is the point of having packages/modules instead of just simply importing by a relative filepath? Is it just so that it's consistent with refering to a symbol by it's fully-qualified name, or forcibly disallowing absolute paths when importing, or are there other reasons? ------------------------------- Not sent from an iPhone.Java supports mobile code. Class loaders can resolve code over the network, not against a relative filesystem. The Java package naming convention is based on a reversed URL for an organization (e.g. com.myorg.whatever), which is presumably unique. It servers as a namespace mechanism.
Jun 29 2010
On Tue, 29 Jun 2010 14:51:49 -0400, Nick Sabalausky <a a.a> wrote:In a language that has a package system that forces package names to be the same as the directory name, and module names to be the same the file name (Such as Java, but not D): What is the point of having packages/modules instead of just simply importing by a relative filepath? Is it just so that it's consistent with refering to a symbol by it's fully-qualified name, or forcibly disallowing absolute paths when importing, or are there other reasons?Java doesn't import source files, it imports compiled objects. Therefore, the file/module relationship is superficial -- you could just as easily create a java compiler that can compile all packages/modules in one file. I think the file/directory model just is easy for people to understand and maintain. D is different in that it actually requires the source for importing. I've always hoped that D moved more towards an import model that used compiled objects instead of the source. There's always the chance that objects are out of sync with source, and the compiler can add annotations for things like full escape analysis if what you import is always generated. -Steve
Jun 29 2010
== Quote from Steven Schveighoffer (schveiguy yahoo.com)'s articleOn Tue, 29 Jun 2010 14:51:49 -0400, Nick Sabalausky <a a.a> wrote:Java Class loaders observe the JVM class file format. This format in turn specifies that class and interface names always be fully qualified package names. The dependency resolution and dynamic binding mechanisms presumably rely upon this. Conceptually, this apparatus could be modified to support an alternate scheme, but the one class per file is not just superficial.In a language that has a package system that forces package names to be the same as the directory name, and module names to be the same the file name (Such as Java, but not D): What is the point of having packages/modules instead of just simply importing by a relative filepath? Is it just so that it's consistent with refering to a symbol by it's fully-qualified name, or forcibly disallowing absolute paths when importing, or are there other reasons?Java doesn't import source files, it imports compiled objects. Therefore, the file/module relationship is superficial -- you could just as easily create a java compiler that can compile all packages/modules in one file. I think the file/directory model just is easy for people to understand and maintain. D is different in that it actually requires the source for importing. I've always hoped that D moved more towards an import model that used compiled objects instead of the source. There's always the chance that objects are out of sync with source, and the compiler can add annotations for things like full escape analysis if what you import is always generated. -Steve
Jun 29 2010
== Quote from Todd VanderVeen (tdv part.net)'s article== Quote from Steven Schveighoffer (schveiguy yahoo.com)'s articleSteve, I confused your statement "can compile all packages/modules in one file". I read that as compile into a class file, not compile from one source file. One public type per class file seems necessary to simplify identification during class loading and minimize network bandwidth, but one class per source file does seem superficial. This was apparently done to optimize the Oak compiler, i.e. avoid parsing the files to determine what types were present. http://www.artima.com/weblogs/viewpost.jsp?thread=7555 Todd V.On Tue, 29 Jun 2010 14:51:49 -0400, Nick Sabalausky <a a.a> wrote:Java Class loaders observe the JVM class file format. This format in turn specifies that class and interface names always be fully qualified package names. The dependency resolution and dynamic binding mechanisms presumably rely upon this. Conceptually, this apparatus could be modified to support an alternate scheme, but the one class per file is not just superficial.In a language that has a package system that forces package names to be the same as the directory name, and module names to be the same the file name (Such as Java, but not D): What is the point of having packages/modules instead of just simply importing by a relative filepath? Is it just so that it's consistent with refering to a symbol by it's fully-qualified name, or forcibly disallowing absolute paths when importing, or are there other reasons?Java doesn't import source files, it imports compiled objects. Therefore, the file/module relationship is superficial -- you could just as easily create a java compiler that can compile all packages/modules in one file. I think the file/directory model just is easy for people to understand and maintain. D is different in that it actually requires the source for importing. I've always hoped that D moved more towards an import model that used compiled objects instead of the source. There's always the chance that objects are out of sync with source, and the compiler can add annotations for things like full escape analysis if what you import is always generated. -Steve
Jun 29 2010
On 29/06/2010 19:51, Nick Sabalausky wrote:In a language that has a package system that forces package names to be the same as the directory name, and module names to be the same the file name (Such as Java, but not D): What is the point of having packages/modules instead of just simply importing by a relative filepath? Is it just so that it's consistent with refering to a symbol by it's fully-qualified name, or forcibly disallowing absolute paths when importing, or are there other reasons? ------------------------------- Not sent from an iPhone."forcibly disallowing absolute paths when importing" Thats one reason. Also: * Enforcing imports of D files only, and not files with other extensions. As a consequence, no need to specify D file extension. * Making it clear packages and modules names can only be valid D identifiers (ie, no spaces, non alphanumerical symbols, etc.) Those are reasons enough I hope. -- Bruno Medeiros - Software Engineer
Jul 08 2010