Trying to use Mir ion, its a perfect example of the failure of D's attribute system
Timon Gehr
timon.gehr at gmx.ch
Sat Jan 21 18:14:09 UTC 2023
On 1/20/23 15:53, Steven Schveighoffer wrote:
> On 1/20/23 8:08 AM, Quirin Schroll wrote:
>
>>
>> If D added 1 fixed-name attribute variable per attribute (cf.
>> `inout`), they could be spelled `@safety`, `purity`, `@gcness`, and
>> `throwiness`.
>>
>> ```d
>> void callInSequence(
>> void delegate() @safety purity @gcness throwiness[] dgs
>> ) @safety purity @gcness throwiness
>> {
>> foreach (dg; dgs) dg();
>> }
>> ```
>
> My proposal was basically to have a `@called` attribute that indicates
> the function delegate may be called inside the function, meaning the
> attributes of the call should reflect the attributes of the parameter.
The issue with that is that it does not generalize/compose. E.g., you
can't write a non-templated function that composes two delegates while
preserving attributes.
More information about the Digitalmars-d
mailing list