CTFE can't replace @properties
12345swordy
alexanderheistermann at gmail.com
Thu Oct 8 16:47:07 UTC 2020
On Thursday, 8 October 2020 at 16:11:02 UTC, H. S. Teoh wrote:
> On Thu, Oct 08, 2020 at 03:21:57PM +0000, 12345swordy via
> Digitalmars-d wrote:
>> Reason being that it doesn't support binary operators nor
>> unary operators, by using the two functions. It a bad idea to
>> allow ctfe to implement them implicitly as that could lead to
>> unintentional design by the programmer.
>>
>> It would be better to implement properties properly and to
>> deprecate the @properties attribute.
> [...]
>
> I'm having a hard time understanding what you're trying to say.
> Could you post some code that illustrates the problem?
>
>
> T
int _x;
public
int x () { return _x; }
int x (int x) { this._x = x; }
x += 2; // you can't do this.
x++ //nor this.
More information about the Digitalmars-d
mailing list