simple definition of "in" function parameters, and default "ref"

Adam D. Ruppe destructionator at gmail.com
Sun Oct 28 00:10:24 UTC 2018


On Saturday, 27 October 2018 at 22:32:48 UTC, 12345swordy wrote:
> The "in" feature perplex me here, I never understand why we 
> couldn't simply write "const scope" instead of "in".

`in` is a counterpoint to `out`.

`out` means the function is going to write a value to that 
variable as output.

`in` means the function is going to look at the value, but 
otherwise not touch it.

> better off to mean "(foreach var a in x)" for readability sake 
> instead of using as a parameter that no-one seems to be hardly 
> using.

there's no reason it couldn't be both.


More information about the Digitalmars-d mailing list