On Tuesday, 21 June 2016 at 21:11:39 UTC, ag0aep6g wrote:
Works when you change the return type of the the @property opDispatch to auto, so that it can return the result. It's a little weird, but D does support calling functions with assignment syntax.

Alternatively, maybe you can actually check for the @property attribute in hasAssignableProperty. See FunctionAttribute/functionAttributes in std.traits [1]. I haven't tested this.


[1] http://dlang.org/phobos/std_traits.html#.FunctionAttribute

Thank you very much!

I managed to get it to work by using this code:

    @property auto opDispatch(string name, Arg)(Arg arg)
    {
        mixin("return _p_data." ~ name ~ " = arg;");
    }

It's a little weird, but D does support calling functions with assignment syntax.

Definitely strange.

Reply via email to