You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
julia>functionfoo()
if@generatederror("some bug in code generation")
elsedet(rand(100,100))
endend
foo (generic function with 2 methods)
julia>foo()
3.0930222047
I know - the compiler is allowed to pick whichever branch it wants, so technically there's nothing wrong here. But this behavior (skipping to the alternative branch whenever there's an error in codegen) makes development really tricky, since nothing will suggest that there's anything wrong, assuming that the non-generated branch is correct.
I don't know how Julia decides which branch to run, but my expectation was that it would either run the codegen in the generated branch first (thus triggering the error), or at least run inference on the code-generation code (thus seeing that its output-type is Union{} - in which case it's clear that something's wrong). Could we get an error in those cases?
More generally, it'd be nice to have some guidelines about the compiler's decision process for optionally generated functions, because otherwise it's hard to rely on for performance. Perhaps that's a separate issue though.
The text was updated successfully, but these errors were encountered:
When run interactively, or inside a file,
I know - the compiler is allowed to pick whichever branch it wants, so technically there's nothing wrong here. But this behavior (skipping to the alternative branch whenever there's an error in codegen) makes development really tricky, since nothing will suggest that there's anything wrong, assuming that the non-generated branch is correct.
I don't know how Julia decides which branch to run, but my expectation was that it would either run the codegen in the generated branch first (thus triggering the error), or at least run inference on the code-generation code (thus seeing that its output-type is
Union{}
- in which case it's clear that something's wrong). Could we get an error in those cases?More generally, it'd be nice to have some guidelines about the compiler's decision process for optionally generated functions, because otherwise it's hard to rely on for performance. Perhaps that's a separate issue though.
The text was updated successfully, but these errors were encountered: