> On Dec 31, 2025, at 11:29 PM, Gary Guo <[email protected]> wrote:
[..]
>> 
>>> 
>>>> 
>>>>       reg.set_foo(x);   // no IO
>>>>       reg.set_sec(y);
>>>>       reg.write(bar);   // IO.
>>>> 
>>>> So no thank you, I quite dislike it. :)
>>>> 
>>>> Instead with chaining, we can just rely on the last part of the chain 
>>>> concluding
>>>> in a write() with the intermediaries just mutating memory.  
>>> 
>>> Same as above, just a more happy-happy chaining interface, but the same
>>> function calls must be made in the same order.  
>> 
>> No, you cannot place write() anywhere except at the end of the chain - the 
>> type
>> system enforces this since write() returns ().
> 
> One thing that probably should be added though is `#[must_use]`
> annotations on these set functions; this would ensure that if someone
> writes
> 
>    reg.set_foo();
> 
> the compiler would complain that the return value is not used.

True! I thought we already did that, thanks Gary for pointing this out.

I will add to my Todo list to get to it unless someone beats me to it ;-)

 - Joel



> 
> Best,
> Gary
> 
> 

Reply via email to