在 D 中测试以下内容
import std.stdio;
struct S
{
int _val;
@property ref int val() { return _val; }
@property void val(int v) { _val = v; writeln("Setter called!"); }
}
void main()
{
auto s = S();
s.val = 5;
}
产量"Settter called!"
作为输出。
编译器使用什么规则来确定是调用第一个实现还是第二个实现?