_aaApply2

IchorDev zxinsworld at gmail.com
Mon Jul 22 15:25:32 UTC 2024


On Monday, 22 July 2024 at 11:11:53 UTC, Quirin Schroll wrote:
> The range interface doesn’t really support key–value pair 
> iteration.

Yes it does?

> An AA can be iterated by values or keys and values. A range 
> interface can’t do that.

Indeed, only one or the other. We should really fix this somehow 
though, because opApply sucks with all of D’s different function 
attributes.

> The issue is that iteration isn’t `nothrow`, but I don’t know 
> why. It makes no sense.

I guess because the function calls an un-marked delegate? I’m not 
even sure how I’m able to call it in `@safe` code though, and yet 
it supposedly uses the GC just for iteration? And heaven forbid C 
code tries to call it, since it’s `extern(C)` but supposedly 
throws…


More information about the Digitalmars-d mailing list