DIP1000: Memory Safety in a Modern System Programming Language Pt.1

Dukc ajieskola at gmail.com
Wed Jun 22 21:44:52 UTC 2022


On Wednesday, 22 June 2022 at 21:07:50 UTC, Ola Fosheim Grøstad 
wrote:
> On Wednesday, 22 June 2022 at 20:48:13 UTC, Steven 
> Schveighoffer wrote:
>> The part about `scope` being shallow. This is a problem.
>
> One thing that will be confusing to most users is that it 
> appears to be using "taint" rather than proper flow analysis on 
> the pointed-to-object?
>
> ```d
> int* test(int arg1, int arg2) {
>     int* p = null;
>     p = &arg1;
>     p = new int(5);
>     return p;  // complains about p being scope
> }
> ```

I'd personally prefer if variable `scope` auto-inference worked 
only in the declaration, not later assignments. I guess the 
intention is to break less existing code.

Your solution would break even less, but it'd mean the language 
rules depend on flow analysis.

Because the rules are now "official", probably best to leave them 
as is to avoid confusion.


More information about the Digitalmars-d-announce mailing list