Jonathan M Davis kirjoitti 31.7.2024 klo 19.00:
The problem with slicing static arrays does exist without DIP 1000, but that
can be solved by actually treating it as @system like it should be (since
it's basically just a different syntax for taking the address of a local
variable for a specific type of variable). Removing implicit slicing of
static arrays also improves the situation since then you don't get surprises
where you're doing something @system without realizing it. DIP 1000 is not
required to solve that problem.

We also need to disable taking a pointer of a struct field, if that struct is local or `ref` (including the `this` `ref`). But adding that, yes, works. This is exactly what Robert proposed at last DConf. I'm going to call his proposal Simple Safe D as per the title of the talk.

It would keep the language as simple as it's without DIP1000 and would be memory safe, but it would break existing code just as hard as DIP1000 does. Plus, nothing in DIP1000 forces you to use it's extra features compared to Simple Safe D. You can avoid the compiler complaining by simply using the GC either way.

Reply via email to