Trying to use Mir ion, its a perfect example of the failure of D's attribute system

Steven Schveighoffer schveiguy at gmail.com
Mon Jan 23 02:15:21 UTC 2023


On 1/22/23 3:43 AM, A moo person wrote:
> On Friday, 20 January 2023 at 14:53:49 UTC, Steven Schveighoffer wrote:
>> 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.
>>
> 
> I really hate that the proposal to the problem of too many attributes in 
> the language is "hey lets add another attribute"... like really?

The problem of "too many attributes" is not what is causing your project 
to fail to build. It is a lack of expressiveness in the language that 
forces mir ion to make a choice -- enforce the most restrictive 
attributes for templates and delegates, or remove all of them and force 
the user not to care about purity/safety/gc.

It shouldn't have to make that choice. A library should only put 
restrictions on its users that it requires. Otherwise, the user should 
be free to pick unsafety, safety, gc or nogc, etc.

Ideally, D should be able to do inference of everything, but separate 
compilation makes this impossible. So we have attributes to designate 
what the declaration has.

-Steve


More information about the Digitalmars-d mailing list