`in` parameters made useful

Fynn Schröder fynnos at live.com
Wed Aug 5 07:27:57 UTC 2020


On Friday, 31 July 2020 at 21:49:25 UTC, Mathias LANG wrote:
> B) It makes `in` take the effect of `ref` when it makes sense. 
> [...]
> C) It implements covariance rules
> [...]
> D) It allows to pass rvalues to `in`.

This sounds so great! Thank you for improving `in`!

> I hope this will generate interest with people hitting the same 
> problem.

I've literally yesterday written some new code with `const scope 
ref` in almost every function to pass large, complex structs. 
Occasionally, I had to store rvalues temporarily to pass as 
lvalues (non-templated code). I would rather simply put `in` on 
those parameters :-) It's a lot easier to grasp function 
signatures only using `in` and `out` on parameters (and their 
effect/purpose being immediately obvious to new D programmers!)


More information about the Digitalmars-d mailing list