Discussion Thread: DIP 1032--Function pointers and Delegate Parameters...--Community Review Round 1

Walter Bright newshound2 at digitalmars.com
Wed Jul 29 08:11:43 UTC 2020


On 7/28/2020 9:45 PM, H. S. Teoh wrote:
> In that case, what about extending inout to attributes besides const?

Because people find inout confusing, and this would just make that worse.


> It's basically the same idea as inout: as far as the function body is
> concerned, it's pure (resp. const); but to the caller, it could be pure
> or impure (resp. immutable/mutable) depending on what was passed in. I
> argue that this would be much more useful than what this DIP proposes.

The only time you'd need fewer attributes on delegate is if the function never 
actually calls it. I submit that this is a relatively rare case, and can be 
handled other ways (like making the function a template and letting it infer its 
attributes).


More information about the Digitalmars-d mailing list