-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request]: System for writing hints to JET into package code #577
Comments
#JET-hint assume_safe: √ I assume this is intended to avoid having to see JET errors for I don't like the idea of simply declaring I would prefer that the definition of |
This doesn't affect the execution or running of the program at all (it's a comment), so there's nothing unsafe about it. All I'm saying is that I want a way to communicate to JET "please don't waste time, or visual space analyzing and reporting from inside
I see that as a pretty separate request, and also one that I'd argue is out of scope for JET. |
I think this is a decision best made by the callers of For example, different users might have:
So consider a tag/label system. Function writer says function foo(x)
# jet-label: √x validated
√x + one(x)
end and the Situation 1 end user says: report_package(P, ignore_labels=[:validated]) The signature hint # JET-hint: x::Union{Int, Float64, Matrix{Complex{Float64}}}
function foo(x) seems like a discussion to be had in a separate issue from the "ignore this" API. |
So we agree? That hint is only there for the purposes of If someone else had their own package that calls |
I think it'd be useful if at least for the purposes of
report_file
, there was a way to write hints to JET as comments in the source code.I'm thinking of something like
The idea here would be that running
report_package(TestPackage)
would see these comments, and instead of trying to analyzef(::Any)
or just not analyzingf
, it would analyzef(::Union{Int, Float64, Matrix{Complex{Float64}}})
, basically as a use-supplied heuristic for what sorts of types they expect this function to take.While analyzing that definition, it could make use of the
#JET-hint assume_safe: √
to not analyze√
, and instead just use the inferred return type of√x
to continue analyzing.The text was updated successfully, but these errors were encountered: