On Wednesday, 15 April 2015 at 17:28:01 UTC, John Colvin wrote:
On Wednesday, 15 April 2015 at 14:44:48 UTC, Idan Arye wrote:
import std.stdio;

struct Foo {
   bool registered = false;

   void register(int x) {
       writeln("Registering ", x);
       register = true;
   }
}

void main() {
   Foo foo;
   foo.register(10);
}

Property assignment syntax for non-property functions is a horrible, horrible thing.

Could someone please explain what is actually happening in that piece of code to a D newbie? I see what happens when I run the code but I don't get why it is happening.
In particular what "register = true;" actually does in that case.

Thanks,
Caspar

Reply via email to