Re: How to move an associative array between modules?

2018-01-12 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Jan 12, 2018 at 08:46:50PM +, WhatMeWorry via Digitalmars-d-learn wrote: [...] > I hate to keep being a bother, but my project with the below static > this() now compiles fine, but aborts during runtime with a "a problem > caused the program to stop working ..." Is there a way to get

Re: How to move an associative array between modules?

2018-01-12 Thread WhatMeWorry via Digitalmars-d-learn
On Thursday, 11 January 2018 at 23:29:30 UTC, Adam D. Ruppe wrote: On Thursday, 11 January 2018 at 23:20:44 UTC, WhatMeWorry wrote: When I simply move the array out of main() but still in app.d, the compiler returns Error: expression ["SCRATCH":Track("scratch.wav", cast(Sound)1, 0, null),...

Re: How to move an associative array between modules?

2018-01-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 11 January 2018 at 23:20:44 UTC, WhatMeWorry wrote: When I simply move the array out of main() but still in app.d, the compiler returns Error: expression ["SCRATCH":Track("scratch.wav", cast(Sound)1, 0, null),... is not a constant. Can I use "static if" or "static this()", or

How to move an associative array between modules?

2018-01-11 Thread WhatMeWorry via Digitalmars-d-learn
I've built a sound.d module with lots data types, free functions (initAndOpenSound() loadSound()), and enums etc. In my main/app.d module, I've created the the following associative array: void main(string[] argv) { initAndOpenSound(); Track[string] tracks = [ "SCRATCH"