Editions Ideas

Richard Andrew Cattermole (Rikki) richard at cattermole.co.nz
Thu Dec 25 22:33:28 UTC 2025


On Wednesday, 24 December 2025 at 11:32:05 UTC, Vladimir 
Panteleev wrote:
> On Friday, 12 December 2025 at 23:05:27 UTC, Walter Bright 
> wrote:
>> Now that Editions have been implemented (thanks Atila, Dennis, 
>> and Rikki) it's time to solicit D features to be dropped from 
>> the next Edition of D.
>
>
> Please could we finally fix `@property`
>
> Also see the OpenD changes list:
>
> https://opendlang.org/changes.html

Here are my notes on this:

- Fix ``@property``
	- It is not property functions, it is a named expression with 
zero or one arguments. The confusion of its scope has been solely 
due to this problem. Rename it to ``@namedexpr``
	- Once ``@namedexpr`` is applied to an overload set, either all 
members in the overload set must be ``@namedexpr`` or none of 
them.
		- This is required to ensure that behavior is consistent 
between all functions for a given named expression.
	- Lower getter function calls to: ``auto val = func(), val``, 
use by-ref if it returns by-ref.
		- This makes ``&func`` become ``typeof(ReturnType!func)`` not 
``typeof(func)``.
		- Use ``&__traits(getOverloads`` to get the actual function 
pointer.
		- This allows:
			```d
			struct A {
				@namedexpr Callable foo();
			}
			A a;
			a.foo();
			```
		- If a gotten from value has been mutated and it is not by-ref 
(i.e. mutable function call on it), call the modify-in-place 
setter. In the form of: ``void func(ref T val)``
			- I.e.
			```d
			// func++;
			auto val = func(), val++, func(val);
			```
			- Do not use the setter, use the modify-in-place setter 
instead. If you use the setter you will need more temporaries if 
the type changes, or make it inaccessible if it returns void.


More information about the Digitalmars-d mailing list