digitalmars.D.learn - package.d imports
- Lemonfiend (39/39) Jan 16 2014 The following behavior seems odd to me. Could anyone explain why
- Lemonfiend (4/4) Jan 16 2014 Sorry, that's
- Colden Cullen (3/43) Jan 17 2014 I think this is what you are looking for:
- Lemonfiend (4/6) Jan 17 2014 What an odd place to put it..
- Leandro Motta Barros (7/13) Jan 18 2014 Hi!
The following behavior seems odd to me. Could anyone explain why it works as it does? (Does package.d have a page on dlang.org?) --- main.d module main; void main() { test1(); test2(); } void test1() { import pack; // works foo(); // works, did not expect it to pack.foo(); // does not work: Error: undefined identifier 'sub' //pack.sub.foo(); } void test2() { import pack.sub; // works foo(); // works, even more unexpectedly pack.foo(); // works pack.sub.foo(); } --- package/pack.d module pack; public import pack.sub; --- package/sub.d module pack.sub; void foo() { import std.stdio; writeln("hello"); }
Jan 16 2014
On Thursday, 16 January 2014 at 15:46:01 UTC, Lemonfiend wrote:The following behavior seems odd to me. Could anyone explain why it works as it does? (Does package.d have a page on dlang.org?) --- main.d module main; void main() { test1(); test2(); } void test1() { import pack; // works foo(); // works, did not expect it to pack.foo(); // does not work: Error: undefined identifier 'sub' //pack.sub.foo(); } void test2() { import pack.sub; // works foo(); // works, even more unexpectedly pack.foo(); // works pack.sub.foo(); } --- package/pack.d module pack; public import pack.sub; --- package/sub.d module pack.sub; void foo() { import std.stdio; writeln("hello"); }I think this is what you are looking for: http://dlang.org/changelog.html#import_package
Jan 17 2014
I think this is what you are looking for: http://dlang.org/changelog.html#import_packageWhat an odd place to put it.. Too bad, it doesn't mention anything about calling the functions like in my example, and why some do/don't work. I'd hoped for more.
Jan 17 2014
Hi! I made similar questions here a month ago, but also couldn't get definitive answers. I just sent a message about this to the main D forum. Let's see if we have better luck there :-) Cheers, LMB On Fri, Jan 17, 2014 at 5:39 PM, Lemonfiend <lemon fie.nd> wrote:I think this is what you are looking for: http://dlang.org/changelog.html#import_packageWhat an odd place to put it.. Too bad, it doesn't mention anything about calling the functions like in my example, and why some do/don't work. I'd hoped for more.
Jan 18 2014