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

Avrina avrina12309412342 at gmail.com
Wed Jul 29 12:48:50 UTC 2020


On Wednesday, 29 July 2020 at 08:20:14 UTC, Walter Bright wrote:
> On 7/28/2020 7:03 PM, Avrina wrote:
>> *It is* pure. The only thing that wouldn't be pure would be 
>> the delegate call.
>
> "Sort of pure", "mostly pure", "pure except for the impure 
> stuff" all mean "not pure" and is not useful.

I've provided an example that is useful. It wouldn't be limited 
to pure. Having the function attributes adapt to the delegate is 
useful.

All this DIP does is reduce attribute, SLIGHTLY, with an odd rule 
at that. I'd rather the attribute be explicit on the delegate of 
a function. Rather than having some hacky workaround with an 
alias in another scope.

If the problem you are trying to solve is to reduce attribute 
bloat, there are better ways for this to be achieved. Of which 
wouldn't cause a breaking change.

>> It'd be no different than what you can already do today with 
>> lazy.
>
> Lazy is headed for deprecation because it has such unprincipled 
> behavior.
>
> Writing pure code in D is hard because D's purity checks have 
> teeth in them. But the teeth make it worthwhile and useful. 
> Otherwise it would just be an empty suit.

It's not limited to pure, it would work for nothrow, @nogc, 
@safe, etc...

You can make the same argument for the new proposed feature, but 
in this case you'd still get the compiler's help in identifying 
when it isn't actually pure. You are literally dissecting your 
own argument you made against this proposal. And IIRC you viewed 
"lazy" as a failed experiment yet you are still defending its' 
flaws.



More information about the Digitalmars-d mailing list