`in` parameters made useful
James Blachly
james.blachly at gmail.com
Sun Aug 23 17:35:23 UTC 2020
On 8/5/20 3:27 AM, Fynn Schröder wrote:
> On Friday, 31 July 2020 at 21:49:25 UTC, Mathias LANG wrote:
>> 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!)
Sorry to interject d.D.learn material in this thread, but where is
"scope ref" documented? I found
https://dlang.org/spec/function.html#scope-parameters which discusses
the use of `scope` with ref type parameters, but the example given is
pointer-based. Is it correct that `scope ref T` behaves the same as
`scope T*` ?
DIP1000 shows as "superseded"
I am glad D is iterating and improving on safety, but I have found that
documentation may not well recent changes in this area.
More information about the Digitalmars-d
mailing list