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

Jonathan Marler johnnymarler at gmail.com
Fri Apr 3 23:05:52 UTC 2020


On Friday, 3 April 2020 at 10:30:33 UTC, Mike Parker wrote:
> This is the discussion thread for the first round of Community 
> Review of DIP 1032, "Function pointers and Delegate Parameters 
> Inherit Attributes from Function":
>
> https://github.com/dlang/DIPs/blob/0c99bd854302ade3e6833080410e9050fddec346/DIPs/DIP1032.md
>
> The review period will end at 11:59 PM ET on April 17, or when 
> I make a post declaring it complete. Discussion in this thread 
> may continue beyond that point.
>
> Here in the discussion thread, you are free to discuss anything 
> and everything related to the DIP. Express your support or 
> opposition, debate alternatives, argue the merits, etc.
>
> However, if you have any specific feedback on how to improve 
> the proposal itself, then please post it in the feedback 
> thread. The feedback thread will be the source for the review 
> summary I write at the end of this review round. I will post a 
> link to that thread immediately following this post. Just be 
> sure to read and understand the Reviewer Guidelines before 
> posting there:
>
> https://github.com/dlang/DIPs/blob/master/docs/guidelines-reviewers.md
>
> And my blog post on the difference between the Discussion and 
> Feedback threads:
>
> https://dlang.org/blog/2020/01/26/dip-reviews-discussion-vs-feedback/
>
> Please stay on topic here. I will delete posts that are 
> completely off-topic.

If this were implemented, I'd prefer for it to be "opt-in" with 
an attribute such as @inherit 
(https://forum.dlang.org/post/plvqxehkjzxkvhsacjwp@forum.dlang.org), however, even if it was opt-in, I'm still not a huge fan of this feature.  Reason being that I favor making code "easier to read" rather than "easier to write".  Adding a new "attribute inheritance" semantic, whether implicitly or explicitly adds cognitive burden to the reader.  You now have to have extra knowledge about when attributes are inherited, whereas with the status quo, you don't have to think about it because all attributes are explicit.  And even if we make it opt in, now you have to learn a new syntax and/or attribute and how it works.  For me the benefit doesn't really justify the added complexity.

P.S. What about delegate types defined inside functions? Would 
they also inherit the functions attributes? @safe pure nothrow 
void foo() { alias D = void delegate(); D d; }


More information about the Digitalmars-d mailing list