microsoft / hlsl-specs

HLSL Specifications
MIT License
123 stars 33 forks source link

Rework some wording around out and inout parameters #312

Closed llvm-beanz closed 1 month ago

llvm-beanz commented 2 months ago

This somewhat future proofs some aspects of the language here by saying that [in]out parmaeter initialization is copy-initialization, but the writeback assignment is assignment. That allows for clarity around overloaded operators so that the argument life becomse something like this:

auto &ArgTmp = (Arg); // Evaluate the argument expr saving it.
T Param = ArgTmp;     // Copy-initialize Param with Arg's result.
call(Param);          // Call the function.
ArgTmp = Param;       // Assign back the Param result with =.