Associative Arrays with elements having function type?

Quirin Schroll qs.il.paperinik at gmail.com
Tue Nov 11 17:58:33 UTC 2025


On Monday, 3 November 2025 at 22:29:13 UTC, H. S. Teoh wrote:
> On Mon, Nov 03, 2025 at 09:29:47PM +0000, kdevel via 
> Digitalmars-d wrote:
>> Yesterday I read
>> 
>>     3. Neither the KeyTypes nor the element types of an 
>> associative array
>>     can be function types or void.
>> 
>> in <https://dlang.org/spec/hash-map.html>. Does the program 
>> below work only accidentally?
> [...]
>
> I think this is a mistake in the spec. There is no reason why 
> the value type of an AA can't be a function (pointer) or 
> delegate.  I use this quite a lot.

There’s a big difference between a function type and a function 
pointer type. (I don’t know why D even has function types. 
Borderline useless.)



More information about the Digitalmars-d mailing list