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 05:48:26 UTC 2023


On 1/19/23 10:38 PM, Walter Bright wrote:
> On 1/19/2023 6:18 PM, Adam D Ruppe wrote:
>> Ideally, you'd be able to say `process` inherits the nogc-ness of 
>> `userData`.
> 
> That's exactly what template attribute inference does.
> 

Not exactly what is being asked (though the quote implies it).

What is being asked is for process to inherit the nogc-ness of *the 
argument passed to userData*.

That is, you know process is calling `userData`, and you want that to 
figure into the inference (this doesn't technically require a template).

What we want is the effective attributes of the function to be the most 
restrictive possible of both the code inside the function, and the 
argument to the function.

The compiler would need a way to specify this for non-inferred 
functions, but it could be inferred for templates and auto functions.

-Steve


More information about the Digitalmars-d mailing list