-preview=in might break code

Daniel N no at public.email
Sun Oct 4 09:59:01 UTC 2020


On Sunday, 4 October 2020 at 08:57:01 UTC, Walter Bright wrote:
> On 10/2/2020 2:57 PM, Daniel N wrote:
>> Also see the formally accepted DIP1021!
>> https://github.com/dlang/DIPs/blob/148001a963f5d6e090bb6beef5caf9854372d0bc/DIPs/accepted/DIP1021.md
>
> That picks up the obvious cases, but the more subtle ones 
> require @live's Data Flow Analysis to find.

Yes, that's true.

My point is that we are already working towards solving the very 
same issue in a different context. DIP1021 is the first step, 
@live is the final step. It's nothing inherently wrong with 
"-preview=in" but as it's currently designed it depends on the 
solution of @live.

It's also possible to solve in simpler ways, since "-preview=in" 
is just an optimization, one could simply disable it when it's 
not trivial to deduce that it's safe to pass by ref. With every 
new advance in the compiler it could be made more clever...



More information about the Digitalmars-d mailing list