-
Notifications
You must be signed in to change notification settings - Fork 1
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
Couple to ArgCheck? #7
Comments
So the benefit would be very nice default error messages from |
That sounds like a really cool idea! The one thing, I don't think ArgCheck.jl supports is, instead of the check throwing an error, just make it return something else. This could be addressed though by exporting a macro |
Yes sounds cool. I will take care of the @mark :some_label ... @elide :some_label ... Where |
That should be quite easy to add. I'll have a look into that |
It seems to me, that the compiler sometimes moves the markers, so that they don't work: code = quote
$(Expr(:meta, :begin_optional, :argcheck))
error()
$(Expr(:meta, :end_optional, :argcheck))
end
@eval f(x) = $code @code_warntype f("hello") # looks good
Variables
#self#::Core.Compiler.Const(f, false)
x::String
Body::Union{}
1 ─ $(Expr(:meta, :begin_optional, :argcheck))
│ Main.error()
│ $(Expr(:meta, :end_optional, :argcheck))
└── Core.Compiler.Const(:(return), false) @code_warntype optimize=true f("hello") # looks bad
Variables
#self#::Core.Compiler.Const(f, false)
x::String
Body::Union{}
1 ─ invoke Main.error()
│ $(Expr(:unreachable))
│ $(Expr(:meta, :begin_optional, :argcheck))
└── $(Expr(:meta, :end_optional, :argcheck))
|
I don't think this should actually be a problem, since IRTools, and therefore this package, works on untyped IR and I believe these optimizations only occur at a later stage in the compiler pipeline. I might be wrong though, so if you encounter any problems, please open an issue. |
If you want to know, what |
Closed by #8 |
This package looks really cool. I thought about doing something like this in ArgCheck.jl, but wanted to keep it free from dependencies and could not figure out a good way to do it.
How about building this package on top of
ArgCheck.jl
? My idea would be that this package exports@skipargcheck
and reexports@argcheck
and@check
fromArgCheck.jl
. ThenArgCheck.jl
will just place thebegin_argcheck/end_argcheck
markers and be usable with zero dependencies stand alone. But it can also be used along withOptionalArgChecks.@skipargcheck
which removes the marked blocks. What do you think @simeonschaub ?The text was updated successfully, but these errors were encountered: