On Wednesday, 4 April 2018 at 20:01:55 UTC, Ali wrote:
On Wednesday, 4 April 2018 at 19:51:27 UTC, kdevel wrote:
On Wednesday, 4 April 2018 at 19:19:30 UTC, Ali wrote:
BTW: You can't write
void main ()
{
x.writeln;
int x;
}
import std.stdio;
This is because x is not module scope
you can do this
void main ()
{
x.writeln;
}
import std.stdio;
int x;
Cause there's no scope at the module level.
struct A
{
A* a;
~this()
{
// use a
}
}
void main()
{
A b = A(&a);
A a; // in this case "a" destructed before "b", but "b" uses
"a"
}
Destruction and order of destruction becomes much more confusing.
You also can't do scope(exit) at the module level for a reason.
This mess shouldn't be allowed, it just makes it way worse to
understand what is going on.