`in` parameters made useful

Jacob Carlborg doob at me.com
Wed Aug 26 09:57:24 UTC 2020


On Wednesday, 26 August 2020 at 09:10:45 UTC, Atila Neves wrote:

> I think it's preferable because it gives more control to the 
> programmer and there's less magic. And also that enregistering 
> and all that probably belongs in the backend.

I like the idea of Herb Sutter's talk [1], where the programmer 
specifies the semantic behavior of the parameters, instead of the 
mechanics how to pass them. The programmer specifies `in`, `out`, 
`inout`, `move` or `forward`. Then the compiler figures out how 
to achieve the semantics in the most efficient way.

There's nothing in Mathias' proposal that cannot be accomplished 
today with other attributes? So if you want more control, don't 
use `in`.

[1] https://youtu.be/qx22oxlQmKc?t=1258

--
/Jacob Carlborg


More information about the Digitalmars-d mailing list