Trying to use Mir ion, its a perfect example of the failure of D's attribute system
Steven Schveighoffer
schveiguy at gmail.com
Fri Jan 20 14:53:49 UTC 2023
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.
> This works the same way as when `inout(int)[] f() inout` is called on a
> mutable, `const` or `immutable` object, its return type will be `int[]`,
> `const(int)[]`, or `immutable(int)[]` after replacing `inout` with the
> call-side type constructor applied to the object’s type.
Yes, inout is exactly the same type of mechanism
-Steve
More information about the Digitalmars-d
mailing list