JuliaLang/julia

disallow return in finally

Aperta

#57.875 aperta il 24 mar 2025

 (20 commenti) (9 reazioni) (0 assegnatari)Julia (5773 fork)batch import
breakinghelp wantedminor changeneeds pkgeval

Metriche repository

Star
 (48.709 stelle)
Metriche merge PR
 (Merge medio 20g 6h) (157 PR mergiate in 30 g)

Descrizione

This is unfortunate:

julia> function f(x)
           try
               error("test")
           finally
               return x
           end
       end

julia> f(4)
4

Brought up by @dalum on Slack. Would be good to simple make return in a finally block a syntax error. Seems unlikely to be widely used.

Guida contributor