Re: DIP1000 and immutable

2021-04-27 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 27 April 2021 at 14:44:48 UTC, Adam D. Ruppe wrote: On Tuesday, 27 April 2021 at 14:28:12 UTC, jmh530 wrote: However, should it ever matter if you escape an immutable? Your example is a pretty clear case of use-after-free if gloin actually did escape the reference and kept it afte

Re: DIP1000 and immutable

2021-04-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 27 April 2021 at 14:28:12 UTC, jmh530 wrote: However, should it ever matter if you escape an immutable? Your example is a pretty clear case of use-after-free if gloin actually did escape the reference and kept it after main returned. I tried basically the same thing in Rust and i

DIP1000 and immutable

2021-04-27 Thread jmh530 via Digitalmars-d-learn
What is the motivation for DIP1000 also applying to immutable? For instance, in the code (compiled with -dip1000), adapted from the spec [1], you get the same errors with immutable function parameters as you would with mutable ones. However, should it ever matter if you escape an immutable?