Tell us your DIP1000 woes

Paul Backus snarwin at gmail.com
Thu Aug 29 19:38:50 UTC 2024


On Thursday, 29 August 2024 at 16:10:37 UTC, Atila Neves wrote:
> On Wednesday, 28 August 2024 at 14:48:04 UTC, Paul Backus wrote:
>> On Sunday, 25 August 2024 at 13:10:22 UTC, Mike Parker wrote:
>>> [...]
>>
>> Here's an issue that stems from a fundamental shortcoming of 
>> DIP1000's design: you can't write a `@safe` `swap` function.
>>
>> [...]
>
> Interesting, thank you. I went and looked at how Rust fixes 
> this and as I expected it's with an `unsafe` block: 
> https://doc.rust-lang.org/1.80.1/src/core/mem/mod.rs.html#728

To be clear, the issue here is not that the *implementation* 
requires `unsafe`/`@trusted`. The issue is that under the current 
system, it is impossible to give `swap` a `@safe` *function 
signature* that accepts `scope` arguments.

That's why I left the body of the `swap` function out of my 
example. It's completely irrelevant.


More information about the Digitalmars-d mailing list