erator overload for usages like 'obj += 42'. */
@property opOpAssign(string op)(int x) {
write(":"); // came here before
mixin("return value"~op~"=x;");
}
// no need: opUnary(string op)();
}
void main()
{
/* Ok, this is regular ob
On Monday, 19 December 2022 at 07:32:02 UTC, j wrote:
Was my email deleted? Which compiler are you using?
Are you an AI engine?
SDB@79
On Monday, 19 December 2022 at 04:26:39 UTC, Salih Dincer wrote:
On Sunday, 18 December 2022 at 21:17:02 UTC, j wrote:
Why are you using `@property` everywhere?
You are right but if I don't use it for `opCall()` the output
will be like `S(9)`. Likewise, if I don't use `inout`, the
program
On Monday, 19 December 2022 at 04:26:39 UTC, Salih Dincer wrote:
On Sunday, 18 December 2022 at 21:17:02 UTC, j wrote:
Why are you using `@property` everywhere?
You are right but if I don't use it for `opCall()` the output
will be like `S(9)`. Likewise, if I don't use `inout`, the
program
On Sunday, 18 December 2022 at 21:17:02 UTC, j wrote:
Why are you using `@property` everywhere?
You are right but if I don't use it for `opCall()` the output
will be like `S(9)`. Likewise, if I don't use `inout`, the
program is terminated.
I think it's a bug with `std.format` that I said
opCall(int x) {
return value = x;
}
@property opCall() inout {
return value;
}
@property opOpAssign(string op)(int x) {
write(":"); // came here before
mixin("return value"~op~"=x;");
}
// no need: opUnary(string op)();
}
void main()
() inout {
return value;
}
@property opOpAssign(string op)(int x) {
write(":"); // came here before
mixin("return value"~op~"=x;");
}
// no need: opUnary(string op)();
}
void main()
{
S a = S(10),
b = S(-1);
writeln(a + b); // 9
write