What's happening with the `in` storage class

Mike Franklin slavo5150 at yahoo.com
Sat Jun 9 03:12:23 UTC 2018


On Saturday, 9 June 2018 at 02:13:00 UTC, Walter Bright wrote:

> 'in' is supposed to mean 'scope const'. But it was never 
> enforced, meaning that suddenly enforcing it is just going to 
> break code left and right.

I think the breakage would be simple to mitigate.  Anywhere `in` 
is used we display a deprecation message...

"Deprecation: `in` is currently equivalent to `const`.  In 
v2.{whatever} `in` will be changed to `scope const`.  To keep the 
current semantics, replace `in` with `const`.  To silence this 
message change your code to `scope const` or simply ignore this 
message until v2.{whatever}.  See 
https://dlang.org/spec/function.html#parameters for more 
information.

... and update the documentation to explain the change.

Simple! And when v2.{whatever} comes around, we're all set with a 
better D.

Mike



More information about the Digitalmars-d mailing list