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

Dukc ajieskola at gmail.com
Fri Apr 3 22:23:09 UTC 2020


On Friday, 3 April 2020 at 10:31:12 UTC, Mike Parker wrote:
> [snip]

I completely disagree with the notion that delegates with 
conventional syntax should inherit the attributes of the 
function. First, the code breakage is going to be high relative 
to the benefit. Second, we are talking about adding a special 
case to the language semantics, that is likely going to be hard 
to understand and thus, to learn and remember.

If this proposal is changed to only propose this change to `lazy` 
parameters, it might just be worth considering. `lazy` is already 
kind of "special" in it's behaviour so I could see the special 
casing pshycologically easier to accept there. But even there I'm 
sceptical.

What I'm saying next will be off the scope of the DIP, but I say 
it because of the possibility that the DIP is unintentionally 
trying to solve the wrong problem. The biggest problem with 
delegates in attributes is not that they don't infer the 
attributes from the called function -vice versa! In the ideal 
world, the called function would infer it's attributes from the 
delegate, not unlike how `inout` function infers it's return 
value constness from constness of the `inout` parameter.


More information about the Digitalmars-d mailing list