Third draft: Turn properties into first class accessors

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Thu Mar 20 19:24:46 UTC 2025


On 21/03/2025 7:40 AM, 12345swordy wrote:
> On Thursday, 20 March 2025 at 18:17:07 UTC, Richard (Rikki) Andrew 
> Cattermole wrote:
>> Not in the format: https://github.com/dlang/DIPs/blob/master/Template.md
>>
>> The trait ``properties`` could be genericafied i.e. 
>> ``__traits(getFunctionOverload, func, void, int)`` for ``void func(int)``
>>
>> "If it is possbile for the parameters to read and write to the 
>> @property, then the inout parameter must be rewritten as two 
>> parameters that accept both the read and write functions of @property"
>>
>> Needs a spelling and grammer pass.
>>
>> However this example doesn't make sense to this specification.
>>
>> ``void void test(inout int x) { x += 1; }``
>>
>> That variable ``x`` there, is for one ``const`` and can't be mutated, 
>> and two isn't by-ref so it wouldn't affect the global anyway.
>>
>> I'm a tad unsure about this.
>>
>> Needs to explicitly mention that array slicing isn't possible.
> 
> I genuinely have no idea on where you got the 
> "__traits(getFunctionOverload, func, void, int)" from, because it simply 
> doesn't exist on my current third draft here.

Right, the trait you came up with is much more specific but could be 
broadened out to other use cases.



More information about the dip.development mailing list