D not considered memory safe

Nick Treleaven nick at geany.org
Tue Jul 9 15:53:04 UTC 2024


On Monday, 8 July 2024 at 13:20:45 UTC, bachmeier wrote:
> On Monday, 8 July 2024 at 10:30:56 UTC, Nick Treleaven wrote:
>> On Monday, 8 July 2024 at 08:48:56 UTC, Martyn wrote:
>>> * goes memory-safe by default, will break existing code.
>>
>> The idea is that the next 
>> [edition](https://forum.dlang.org/post/tskwospngntbnqiuxbag@forum.dlang.org) is @safe by default. Existing code will not be broken.
>
> We have very few details on what this will look like for 
> someone that doesn't want it.

`@system:`

> Not breaking existing code is far from sufficient for those 
> writing unsafe code. Inference is useless because there's 
> nothing to infer,

@system would be inferred for functions that use unsafe features.

> @trusted loses its meaning,

@trusted continues to mean safe interface, unsafe implementation.

> there's needless boilerplate all over the place, and

`@system:`

> it's more complex for new users of the language. There's no

Users get an error instead of accidentally corrupting memory. 
That's a massive win for new users, assuming they use newer 
editions.

> evidence that any of this has been given consideration, and all 
> apparently because adding -safe to the compilation command is 
> too much of a burden for those wanting the additional checks.

That wouldn't be reliable and wouldn't allow safe/unsafe code to 
interact. We need the code to state what its default is.


More information about the Digitalmars-d mailing list