Is there a way to use the 4-argument `@nloops` with `@generated` on Julia 1.6?

Is there a way to use the 4-argument @nloops with @generated on Julia 1.6? Since the last argument is an anonymous function, it triggers an error about purity now. StatsBase currently uses that so it fails on nightlies: https://github.com/JuliaStats/StatsBase.jl/blob/3b0b2da5179af9696928e5ecc72794b098c4cb53/src/hist.jl#L465

Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appropriate answer back to Slack, or pinging the poster here on Discourse so they can follow this thread.
(Original message :slack:) (More Info)

I turns out the anonymous function was not the problem. It’s just that the function included a generator, which is problematic for @generated.

1 Like