Re: Working with Modules

2016-12-27 Thread Guy Asking a Question via Digitalmars-d-learn
On Wednesday, 28 December 2016 at 02:12:32 UTC, pineapple wrote: On Wednesday, 28 December 2016 at 02:08:44 UTC, Guy Asking a Question wrote: import test; <---dmd choking here. You will need to use the -I option of dmd/rdmd to inform the compiler of where your `HopefullySomeDLibrary` director

Re: Working with Modules

2016-12-27 Thread pineapple via Digitalmars-d-learn
On Wednesday, 28 December 2016 at 02:08:44 UTC, Guy Asking a Question wrote: import test; <---dmd choking here. You will need to use the -I option of dmd/rdmd to inform the compiler of where your `HopefullySomeDLibrary` directory is located, as well as any other places you will want to import

Re: Working with Modules

2016-12-27 Thread Guy Asking a Question via Digitalmars-d-learn
The code... tester.d module main; import std.stdio; import test; <---dmd choking here. int main(string[] args) { writefln("Hello World\n"); writefln(add(a, b)); return 0; } test.d module test; int add(int a, int b) { return a + b; }

Working with Modules

2016-12-27 Thread Guy Asking a Question via Digitalmars-d-learn
I am just starting up with dmd and code::blocks. Generally I have as my project structure something like this (sorry if your forum doesn't format this nicely, use the '-'es for directory nesting): ProjectA -SubProject1 -SubProject2 ProjectB -SubProject1 -SubProjectB HopefullySomeDPr

Re: Working with modules

2013-02-16 Thread Jacob Carlborg
On 2013-02-16 05:19, Jeremy DeHaan wrote: That is really cool! I'll look into this more, but I am using an IDE which would get angry if I included them in my project as .d files and didn't put in a module name, but I think you're on to something here. There's also template mixins that could he

Re: Working with modules

2013-02-16 Thread Jacob Carlborg
On 2013-02-16 15:12, Ali Çehreli wrote: I don't think it is better than any other solution. I got reminded of this possibility; that's all. :) Fair enough. :) -- /Jacob Carlborg

Re: Working with modules

2013-02-16 Thread Ali Çehreli
On 02/16/2013 04:58 AM, Jacob Carlborg wrote: On 2013-02-16 05:14, Ali Çehreli wrote: mixin (import ("part_of_my_module.d")); mixin (import ("another_part_of_my_module.d")); How is that better than public imports. You'll get access to private declarations but besides that. I don't think it

Re: Working with modules

2013-02-16 Thread Jacob Carlborg
On 2013-02-16 05:14, Ali Çehreli wrote: mixin (import ("part_of_my_module.d")); mixin (import ("another_part_of_my_module.d")); How is that better than public imports. You'll get access to private declarations but besides that. -- /Jacob Carlborg

Re: Working with modules

2013-02-15 Thread Jonathan M Davis
On Friday, February 15, 2013 20:14:41 Ali Çehreli wrote: > On 02/15/2013 07:50 PM, Jeremy DeHaan wrote: > > I know that a module can only be defined once, but I feel like there > > could be times where it would be helpful to be able to have the same > > module defined in separate files > > Ther

Re: Working with modules

2013-02-15 Thread Mike Parker
On Saturday, 16 February 2013 at 03:50:12 UTC, Jeremy DeHaan wrote: I was actually going to post a similar question, but it looks like this would be a better place to post! I know that a module can only be defined once, but I feel like there could be times where it would be helpful to be able

Re: Working with modules

2013-02-15 Thread Jeremy DeHaan
On Saturday, 16 February 2013 at 04:14:41 UTC, Ali Çehreli wrote: On 02/15/2013 07:50 PM, Jeremy DeHaan wrote: > I know that a module can only be defined once, but I feel like there > could be times where it would be helpful to be able to have the same > module defined in separate files There m

Re: Working with modules

2013-02-15 Thread Jeremy DeHaan
On Friday, 15 February 2013 at 10:01:35 UTC, Jonathan M Davis wrote: On Friday, February 15, 2013 10:51:00 Colin Grogan wrote: Does anyone here have any alternatives for me so that in my 'engine' or 'main' classes I can simply write: import utils; and still have my source files neatly lai

Re: Working with modules

2013-02-15 Thread Jacob Carlborg
On 2013-02-15 12:04, Colin Grogan wrote: Ah ok, now I get it. Note that in Java you declare a package wheres in D you declare a module. If you have something like this in Java: // Baz.java package bar.foo; You would do this in D: // Baz.d module bar.foo.Baz; -- /Jacob Carlborg

Re: Working with modules

2013-02-15 Thread Colin Grogan
Ok, I had a minute so I tested it out. I had the following: src/main.d: import utils._; void main(string[] args){ logger l = new logger(); props p = new props(); l.print(); p.print(); } src/utils/_.d module utils._; public import utils.props, utils.l

Re: Working with modules

2013-02-15 Thread Colin Grogan
On Friday, 15 February 2013 at 10:40:57 UTC, Dicebot wrote: On Friday, 15 February 2013 at 10:31:41 UTC, Colin Grogan wrote: Ah, ok. So, I have my structure like so: $PROJHOME |-src |-utils |- Logger.d // contains "module utils.Logger" |- Props.d // contains "module

Re: Working with modules

2013-02-15 Thread Dicebot
On Friday, 15 February 2013 at 10:31:41 UTC, Colin Grogan wrote: Ah, ok. So, I have my structure like so: $PROJHOME |-src |-utils |- Logger.d // contains "module utils.Logger" |- Props.d // contains "module utils.Props" |- utils.d // contains "module u

Re: Working with modules

2013-02-15 Thread Jonathan M Davis
On Friday, February 15, 2013 11:31:40 Colin Grogan wrote: > So, I have my structure like so: > > $PROJHOME > > |-src > | > |-utils > | >|- Logger.d // contains "module utils.Logger" >|- Props.d // contains "module utils.Props" >|- uti

Re: Working with modules

2013-02-15 Thread Colin Grogan
On Friday, 15 February 2013 at 10:01:35 UTC, Jonathan M Davis wrote: On Friday, February 15, 2013 10:51:00 Colin Grogan wrote: Does anyone here have any alternatives for me so that in my 'engine' or 'main' classes I can simply write: import utils; and still have my source files neatly lai

Re: Working with modules

2013-02-15 Thread Jonathan M Davis
On Friday, February 15, 2013 10:51:00 Colin Grogan wrote: > Does anyone here have any alternatives for me so that in my > 'engine' or 'main' classes I can simply write: > > import utils; > > and still have my source files neatly laid out in manageable > chunks? The only way that you can hav

Re: Working with modules

2013-02-15 Thread Dmitry Olshansky
15-Feb-2013 13:51, Colin Grogan пишет: [snip] This is where my problem occurs. To illustrate: $PROJHOME |-/src |- utils |- Logger.d |- Properties.d |- SSHTool.d |- engine I want to put Logger.d, Properties.d and SSHTool.d into the

Working with modules

2013-02-15 Thread Colin Grogan
Hi all, I have a question regarding how to lay out my code. I wish to have a project directory structure that resembles java projects (As I'm comfortable working in that sort of environment For example: $PROJHOME |-/src <- Source code |-/lib <- third party libraries |-/bin