On Thursday, 26 October 2017 at 23:29:24 UTC, Walter Bright wrote:
You can also do things like:
--- s.d -------
struct S { int x; ref int X() { return x; } }
--- splus.d ----
public import s;
int increment(S s) { s.X() += 1; } // note no access to S.x
--- user.d ----
import splus;
void foo(ref S s) { s.increment(); }
I'd like to do this too:
-------------------------
import std.stdio;
void main()
{
//int foo;
if (int foo.bar != 0) // no, sorry, you cannot declare foo
here.
{
throw new Exception("foo.bar != 0");
}
}
auto bar(int x,)
{
return -10;
}
-----------------------------------------