Discussion Thread: DIP 1028--Make @safe the Default--Final Review

Walter Bright newshound2 at digitalmars.com
Thu Mar 26 07:28:40 UTC 2020


On 3/25/2020 11:14 PM, Jonathan M Davis wrote:
> On Wednesday, March 25, 2020 11:43:41 PM MDT Walter Bright via Digitalmars-d
> wrote:
>> On 3/25/2020 9:14 PM, Jonathan M Davis wrote:
>>> In general, a D wrapper library around a C library should be presenting
>>> an @safe API
>>
>> A D wrapper should be as thin as possible, which means if the C function
>> being wrapped is safe then the D wrapper should be @safe, and if is not
>> safe then the D wrapper should be @system.
>>
>> For the D wrapper developer, since he's providing a service to the D user,
>> part of the job will be identifying which of the C interfaces are safe
>> and which are system (of course, he can just mark them all as @system
>> just to get things done and move on, and it'll be up to the users of said
>> library if that is acceptable or not).
> 
> There is a huge difference between providing bindings for a C library and
> providing a D wrapper library for a C library.

Yes, you're right.


> That's concerning, since it implies that whoever did it was just slapping
> @trusted on the various C declarations.

Yup.


More information about the Digitalmars-d mailing list