digitalmars.D - MIID Partial modules (Walter)
- Sjoerd van Leent (49/49) Sep 20 2004 Hi all,
- Bastiaan Veelo (32/91) Sep 20 2004 Is this what you are trying to do?
- Sjoerd van Leent (9/110) Sep 20 2004 Bastiaan Veelo wrote:
- J C Calvarese (5/14) Sep 20 2004 I have a strong feeling that I've read these complaints before. And I th...
- Sjoerd van Leent (5/12) Sep 20 2004 Isn't it private what you are talking about? This is not what I meant.
- Ben Hinkle (6/18) Sep 20 2004 search the page http://www.digitalmars.com/d/attribute.html for "package...
- Sjoerd van Leent (8/14) Sep 20 2004 As I understand package is a protection attribute not different from
- Ben Hinkle (11/20) Sep 20 2004 In D you can have any number of classes per file. The only difference
- Sjoerd van Leent (12/40) Sep 21 2004 No it is just a design problem. When defining a subsystem (in UML) and
- pragma (11/22) Sep 21 2004 Would it be acceptable to extend the interface pattern to your file layo...
- Sjoerd van Leent (16/47) Sep 21 2004 Currently it is what I am using right now. But it doesn't make me very
- Benjamin Herr (11/20) Sep 21 2004 pragma wrote:
- Sjoerd van Leent (6/32) Sep 21 2004 I like the first solution of a Directory lookup, but D then needs to put...
- Chr. Grade (5/64) Sep 20 2004 I partially agree. But I think it's the C++ namespaces missing.
- Sjoerd van Leent (12/19) Sep 20 2004 I think the notation as done in D is better, since you don't have to do
Hi all, Currently, D only supports modules on the file level. For small modules this is fine, but for modules with classes it isn't pretty working. Currently without splitting up the modules per class, files become extensively long. As I am working on a school project with D (we may use our own languages, if argumented well :) ) and also use it for myself, I constantly struggle with very long files, searching for things become sometimes a little disaster. Splitting modules per class isn't a good design and weakens the whole idea behind modulair (subsystem) engineering. This is why I ask to consider building in something like partial or dictating modules. The system I have in mind takes uses a master module (or simply a module) and dictates which child modules may be a child of it. Similar to the following: The master file could then be used as: Regards, Sjoerd
Sep 20 2004
Is this what you are trying to do? ./master/all.d ./master/first.d ./master/second.d ./main.d Compile like so: dmd main.d master/first.d master/second.d Cheers, Bastiaan. Sjoerd van Leent wrote:Hi all, Currently, D only supports modules on the file level. For small modules this is fine, but for modules with classes it isn't pretty working. Currently without splitting up the modules per class, files become extensively long. As I am working on a school project with D (we may use our own languages, if argumented well :) ) and also use it for myself, I constantly struggle with very long files, searching for things become sometimes a little disaster. Splitting modules per class isn't a good design and weakens the whole idea behind modulair (subsystem) engineering. This is why I ask to consider building in something like partial or dictating modules. The system I have in mind takes uses a master module (or simply a module) and dictates which child modules may be a child of it. Similar to the following: The master file could then be used as: Regards, Sjoerd
Sep 20 2004
Bastiaan Veelo wrote: No this is different, I know it is possible of course. I don't mean this, because you are making submodules for every class, which is just the opposite from what I mean. For example, in Java it is possible to import a package with let's say 10 classes. Every class is split up in a file. In D you'll have to write one file containing 10 classes (which becomes very large) or you need to split them up *into other modules*, but that weakens modulair design, and is for large projects a pitfall.Is this what you are trying to do? ./master/all.d ./master/first.d ./master/second.d ./main.d Compile like so: dmd main.d master/first.d master/second.d Cheers, Bastiaan. Sjoerd van Leent wrote:Hi all, Currently, D only supports modules on the file level. For small modules this is fine, but for modules with classes it isn't pretty working. Currently without splitting up the modules per class, files become extensively long. As I am working on a school project with D (we may use our own languages, if argumented well :) ) and also use it for myself, I constantly struggle with very long files, searching for things become sometimes a little disaster. Splitting modules per class isn't a good design and weakens the whole idea behind modulair (subsystem) engineering. This is why I ask to consider building in something like partial or dictating modules. The system I have in mind takes uses a master module (or simply a module) and dictates which child modules may be a child of it. Similar to the following: The master file could then be used as: Regards, Sjoerd
Sep 20 2004
In article <cin09f$2t4j$1 digitaldaemon.com>, Sjoerd van Leent says...Bastiaan Veelo wrote: No this is different, I know it is possible of course. I don't mean this, because you are making submodules for every class, which is just the opposite from what I mean. For example, in Java it is possible to import a package with let's say 10 classes. Every class is split up in a file. In D you'll have to write one file containing 10 classes (which becomes very large) or you need to split them up *into other modules*, but that weakens modulair design, and is for large projects a pitfall.I have a strong feeling that I've read these complaints before. And I thought Walter added the package keyword to satisfy those complaints. Am I on crack? Have you tried using "package"? jcc7
Sep 20 2004
Isn't it private what you are talking about? This is not what I meant. If otherwise, please let me know. Regards, Sjoerd J C Calvarese wrote:I have a strong feeling that I've read these complaints before. And I thought Walter added the package keyword to satisfy those complaints. Am I on crack? Have you tried using "package"? jcc7
Sep 20 2004
search the page http://www.digitalmars.com/d/attribute.html for "package". For the definition of packages see the module.html help "Sjoerd van Leent" <svanleent wanadoo.nl> wrote in message news:cin4tp$2ve6$1 digitaldaemon.com...Isn't it private what you are talking about? This is not what I meant. If otherwise, please let me know. Regards, Sjoerd J C Calvarese wrote:thoughtI have a strong feeling that I've read these complaints before. And Icrack?Walter added the package keyword to satisfy those complaints. Am I onHave you tried using "package"? jcc7
Sep 20 2004
Ben Hinkle wrote:search the page http://www.digitalmars.com/d/attribute.html for "package". For the definition of packages see the module.html helpAs I understand package is a protection attribute not different from private, protected and public. It means that your submodules can use your package classes/functions/etcetera but other modules can't. Granted, it is a nice feature, but not what I'm looking for. Though you did learn me a new keyword, that I appreciate! Regards, Sjoerd
Sep 20 2004
"Sjoerd van Leent" <svanleent wanadoo.nl> wrote in message news:cin09f$2t4j$1 digitaldaemon.com...Bastiaan Veelo wrote: No this is different, I know it is possible of course. I don't mean this, because you are making submodules for every class, which is just the opposite from what I mean. For example, in Java it is possible to import a package with let's say 10 classes. Every class is split up in a file. In D you'll have to write one file containing 10 classes (which becomes very large) or you need to split them up *into other modules*, but that weakens modulair design, and is for large projects a pitfall.In D you can have any number of classes per file. The only difference between putting two classes in one module and putting two classes in two modules in the same package is that private variables are no longer shared and that was why Walter introduced package scope. Plus I suppose one has to "import" two modules instead of one but that is a trivial difference. I don't understand why you feel the need to have one huge file containing lots of classes. Are you worrying about people importing only one of the modules in the package? -Ben
Sep 20 2004
Ben Hinkle wrote:"Sjoerd van Leent" <svanleent wanadoo.nl> wrote in message news:cin09f$2t4j$1 digitaldaemon.com...No it is just a design problem. When defining a subsystem (in UML) and different classes belonging to it, I want it to be in the same module, not in different ones. I know it is possible to have a public import (just import without private) but it isn't what I am looking for. I want to make one module with multiple files, with the same properties as a normal module would have. I know it is possible (just as in C++) to have more classes in one module in a file, but I want to have the same module spread over multiple files (More like Java packages or C++ namespaces). Regards, SjoerdSjoerd van Leent wrote: No this is different, I know it is possible of course. I don't mean this, because you are making submodules for every class, which is just the opposite from what I mean. For example, in Java it is possible to import a package with let's say 10 classes. Every class is split up in a file. In D you'll have to write one file containing 10 classes (which becomes very large) or you need to split them up *into other modules*, but that weakens modulair design, and is for large projects a pitfall.In D you can have any number of classes per file. The only difference between putting two classes in one module and putting two classes in two modules in the same package is that private variables are no longer shared and that was why Walter introduced package scope. Plus I suppose one has to "import" two modules instead of one but that is a trivial difference. I don't understand why you feel the need to have one huge file containing lots of classes. Are you worrying about people importing only one of the modules in the package? -Ben
Sep 21 2004
In article <cipbtp$158g$1 digitaldaemon.com>, Sjoerd van Leent says...No it is just a design problem. When defining a subsystem (in UML) and different classes belonging to it, I want it to be in the same module, not in different ones. I know it is possible to have a public import (just import without private) but it isn't what I am looking for. I want to make one module with multiple files, with the same properties as a normal module would have. I know it is possible (just as in C++) to have more classes in one module in a file, but I want to have the same module spread over multiple files (More like Java packages or C++ namespaces). Regards, SjoerdWould it be acceptable to extend the interface pattern to your file layout? //mymodule.all import mymodule.foo1 import mymodule.foo2 import mymodule.foo3 Simply use "import mymodule.all;" and foo1, foo2 and foo3 come with it. This is functionally equivalent to what your asking for (I think anyway) while still keeping your classes spread out across multiple .d files. - Pragma [[ Eric Anderton at yahoo dot com ]]
Sep 21 2004
pragma wrote:In article <cipbtp$158g$1 digitaldaemon.com>, Sjoerd van Leent says...Currently it is what I am using right now. But it doesn't make me very happy. Otherwise I have to use a different code convention (such as class names after the module names etc...). Also I don't want anyone to be able importing a part of the whole, which makes things unreadable (and perhaps undesirable) in large projects. I only ask to consider/think of an extension to the system. Not that the current one is ultimately bad (even if it was, the rest of D would be a very heavy counterweight), but I think it can be even better. Before pissing off the complete newsgroup I want to say that the language itself is good in practice (though it is new) and is very easy, or should I say straightforward to learn. Where other languages need thick, heavy manuals, D can be learned with only an Internet-browser and a good set of working brains. Regards, SjoerdNo it is just a design problem. When defining a subsystem (in UML) and different classes belonging to it, I want it to be in the same module, not in different ones. I know it is possible to have a public import (just import without private) but it isn't what I am looking for. I want to make one module with multiple files, with the same properties as a normal module would have. I know it is possible (just as in C++) to have more classes in one module in a file, but I want to have the same module spread over multiple files (More like Java packages or C++ namespaces). Regards, SjoerdWould it be acceptable to extend the interface pattern to your file layout? //mymodule.all import mymodule.foo1 import mymodule.foo2 import mymodule.foo3 Simply use "import mymodule.all;" and foo1, foo2 and foo3 come with it. This is functionally equivalent to what your asking for (I think anyway) while still keeping your classes spread out across multiple .d files. - Pragma [[ Eric Anderton at yahoo dot com ]]
Sep 21 2004
pragma wrote: > Would it be acceptable to extend the interface pattern to your file layout?//mymodule.all import mymodule.foo1 import mymodule.foo2 import mymodule.foo3 Simply use "import mymodule.all;" and foo1, foo2 and foo3 come with it. This is functionally equivalent to what your asking for (I think anyway) while still keeping your classes spread out across multiple .d files.If we could have a change to how module lookup works, I think it would be easier (for users) or more intuitive if you could still do just #import mymodule; dmd would look for mymodule, notice that it is a directory, and automatically proceed either including all (non-directory) files inside it, or perhaps this.d as it was suggested before, iirc, which would then include all the public import statements. - Ben
Sep 21 2004
Benjamin Herr wrote:pragma wrote: > Would it be acceptable to extend the interface pattern to your file layout?I like the first solution of a Directory lookup, but D then needs to put the directory contents (well, all .d files ofcourse) into one object file. It would solve my problem quite well. Regards, Sjoerd//mymodule.all import mymodule.foo1 import mymodule.foo2 import mymodule.foo3 Simply use "import mymodule.all;" and foo1, foo2 and foo3 come with it. This is functionally equivalent to what your asking for (I think anyway) while still keeping your classes spread out across multiple .d files.If we could have a change to how module lookup works, I think it would be easier (for users) or more intuitive if you could still do just #import mymodule; dmd would look for mymodule, notice that it is a directory, and automatically proceed either including all (non-directory) files inside it, or perhaps this.d as it was suggested before, iirc, which would then include all the public import statements. - Ben
Sep 21 2004
I partially agree. But I think it's the C++ namespaces missing. D lacks a facility which enables code management, grouping or subgrouping, for the purpose of better readability and recognizability. Chr. Grade Sjoerd van Leent wrote:Hi all, Currently, D only supports modules on the file level. For small modules this is fine, but for modules with classes it isn't pretty working. Currently without splitting up the modules per class, files become extensively long. As I am working on a school project with D (we may use our own languages, if argumented well :) ) and also use it for myself, I constantly struggle with very long files, searching for things become sometimes a little disaster. Splitting modules per class isn't a good design and weakens the whole idea behind modulair (subsystem) engineering. This is why I ask to consider building in something like partial or dictating modules. The system I have in mind takes uses a master module (or simply a module) and dictates which child modules may be a child of it. Similar to the following: The master file could then be used as: Regards, Sjoerd
Sep 20 2004
Chr. Grade wrote:I partially agree. But I think it's the C++ namespaces missing. D lacks a facility which enables code management, grouping or subgrouping, for the purpose of better readability and recognizability. Chr. GradeI think the notation as done in D is better, since you don't have to do something odd as: namespace x { namespace y { namespace z { ...code... }}} And I still think that the C++ namespace protection system is not well designed, it is possible to append files to a namespace when wanted. I think that a parent namespace needs to be in control of this. For the rest I agree. Regards, Sjoerd
Sep 20 2004