Re: Is it possible to disallow import for certain functions?

2019-07-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, July 27, 2019 7:12:32 AM MDT evilrat via Digitalmars-d-learn wrote: > On Saturday, 27 July 2019 at 12:48:12 UTC, BoQsc wrote: > > I seem to be doing something wrong, the result is the same. > > > >> otherFile.d(8): Error: only one main, WinMain, or DllMain > >> allowed. Previously fou

Re: struct is not copyable because it is annotated with @disable bugs ?

2019-07-27 Thread Newbie2019 via Digitalmars-d-learn
On Saturday, 27 July 2019 at 17:13:45 UTC, Adam D. Ruppe wrote: If you change that to just plain `return NodeList(a, b);`, while keeping the first line, it will compile too. The reason here is when you return and construct together, it constructs it in-place. But if you put it in a local varia

Re: struct is not copyable because it is annotated with @disable bugs ?

2019-07-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 27 July 2019 at 16:59:44 UTC, Newbie2019 wrote: auto list = NodeList(a, b); If you change that to just plain `return NodeList(a, b);`, while keeping the first line, it will compile too. The reason here is when you return and construct together, it constructs it

struct is not copyable because it is annotated with @disable bugs ?

2019-07-27 Thread Newbie2019 via Digitalmars-d-learn
I think this is a bug. If I return a struct more than one times, will throw this error. If I return once, every thing is ok. https://run.dlang.io/is/T4kWKM ref auto getList() return scope { if( i ) return NodeList(null); // remove this line will fix this error A

Re: Is it possible to disallow import for certain functions?

2019-07-27 Thread evilrat via Digitalmars-d-learn
On Saturday, 27 July 2019 at 12:48:12 UTC, BoQsc wrote: I seem to be doing something wrong, the result is the same. otherFile.d(8): Error: only one main, WinMain, or DllMain allowed. Previously found main at mainFile.d(11) private version = otherMain; version(otherMain) { void main

Re: Is it possible to disallow import for certain functions?

2019-07-27 Thread BoQsc via Digitalmars-d-learn
On Saturday, 27 July 2019 at 12:06:11 UTC, Mike Parker wrote: On Saturday, 27 July 2019 at 12:05:27 UTC, Mike Parker wrote: module otherFile; version otherMain() { ... } eh... version(otherMain) { } I seem to be doing something wrong, the result is the same. otherFile.d(8): Error: only

Re: Is it possible to disallow import for certain functions?

2019-07-27 Thread XavierAP via Digitalmars-d-learn
On Saturday, 27 July 2019 at 11:54:09 UTC, BoQsc wrote: I would like to make sure that function in module that I have won't be imported, is this possible to achieve? In general, make the function private. But indeed, on your case, it is a terrible idea to define a main() function in a module

Re: Is it possible to disallow import for certain functions?

2019-07-27 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 27 July 2019 at 11:54:09 UTC, BoQsc wrote: I would like to make sure that function in module that I have won't be imported, is this possible to achieve? Test subject: mainFile.d import otherFile; void main(){ } otherFile.d import std.stdio : writeln; import std.file

Re: Is it possible to disallow import for certain functions?

2019-07-27 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 27 July 2019 at 12:05:27 UTC, Mike Parker wrote: module otherFile; version otherMain() { ... } eh... version(otherMain) { }

Is it possible to disallow import for certain functions?

2019-07-27 Thread BoQsc via Digitalmars-d-learn
I would like to make sure that function in module that I have won't be imported, is this possible to achieve? Test subject: mainFile.d import otherFile; void main(){ } otherFile.d import std.stdio : writeln; import std.file : mkdir; int main(){ writeln("test ");