Discussion Thread: DIP 1033--Implicit Conversion of Expressions to Delegates--Community Review Round 1

Steven Schveighoffer schveiguy at gmail.com
Thu Apr 23 05:07:01 UTC 2020


Followup discussion to Walter's response to my feedback:

>> int delegate() = 3;
>>
>> doesn't use any globals. Why shouldn't this work?
>>
>> int function() = 3;
> 
> Because it seems kinda pointless to support function pointers only with constants.
> 
> While it is not impossible to support function pointers with this, I can't think of a compelling use case. 

Walter, you literally are using int delegate() = 3 as a use case in the 
DIP. How is a delegate that returns a constant more useful (or 
different) than a function pointer that returns a constant?

The statement "the expression can only consist of globals" is just 
factually incorrect. It can consist of globals, new memory, literals, 
enums, thread local data, the result of some other function call with 
those types of parameters.

I tend to think that it doesn't make a whole lot of sense to exclude 
function pointers in this DIP, but even if you disagree, the text fails 
to convey a valid rationale of why they shouldn't be included.

-Steve


More information about the Digitalmars-d mailing list