dip1000 and preview in combine to cause extra safety errors

John Colvin john.loughran.colvin at gmail.com
Wed Jun 8 16:01:55 UTC 2022


On Wednesday, 8 June 2022 at 15:58:10 UTC, John Colvin wrote:
>
> The preview switch is changing the meaning of `in` which 
> changes the signature of `foo` (which is then inconsistent with 
> the implementation), which in turn will affect the call sites. 
> This seems roughly as expected, no?

E.g. this prints `["o", "o", "o", "o", "o"]` regardless of 
compiler flags

     string foo(scope string s)
     {
         return s;
     }

     void main()
     {
         import std.stdio;
         string[] result;
         foreach(c; "hello")
         {
             result ~= foo([c]);
         }
         writeln(result);
     }


More information about the Digitalmars-d mailing list