On Thursday, March 01, 2018 14:59:38 aliak via Digitalmars-d wrote: > On Wednesday, 28 February 2018 at 23:58:44 UTC, Jonathan M Davis > > wrote: > > On Wednesday, February 28, 2018 19:43:07 Kagamin via > > > > Digitalmars-d wrote: > >> On Wednesday, 28 February 2018 at 14:05:19 UTC, Jonathan M > >> Davis > >> > >> wrote: > >> > [...] > >> > >> Doesn't difficulty depend on what exactly to get right? It's > >> not a spherical problem in vacuum. > > > > Feel free to discuss any code-flow analysis issues with Walter, > > but he's consistently been against using it for much of > > anything whenever I've seen him discuss it. Not even stuff like > > VRP covers multiple lines of code, because doing so would > > require code-flow analysis. And he's specifically said that > > he's against using it for detecting when a null pointer is > > dereferenced. IIRC, he's stated that dmd's optimizer uses > > code-flow analysis for some stuff, but for anything that > > involves putting it in the frontend where the behavior would > > have to be encoded in the spec, he's been against it. > > > > - Jonathan M Davis > > Isn't DIP1000 [1] basically code flow analysis and implemented > (kinda?) in dmd with -dip1000 now? > > [1] https://github.com/dlang/DIPs/blob/master/DIPs/DIP1000.md
DIP 1000 operates based on the type. As I understand it, it looks at the fact that something is scope or not and then determines whether a particular operation is valid or not based on whether the operation could result in a reference to the data escaping. An operation is then valid or not regardless of what other lines in the code are doing. As such, if I understand correctly, code-flow analysis isn't really necessary, just like code-flow analysis isn't necessary to determine what's valid or not when const is involved. - Jonathan M Davis