Giter Site home page Giter Site logo

argcheck.jl's People

Contributors

donm avatar jw3126 avatar mrvplusone avatar ranocha avatar singularitti avatar staticfloat avatar tkelman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

argcheck.jl's Issues

please bring back @argcheck condition "message"

Recent changes deprecated then disallowed

@argcheck condition "message"

and now require explicit specification of an error, eg

@argcheck condition ArgumentError("message")

I think that making things explicit is good design, and I like that I can specify other errors when checking arguments (eg BoundsError, etc), but I still think that ArgumentError is a useful default — after all, the name of the package is ArgCheck.

So I am asking that you please consider allowing the first code snippet above again, making it equivalent to the second. AFAICT the macro should be able to check the AST for a <: AbstractString.

please consider making a CHANGELOG.md

The version was bumped to 2.0 recently yet I am unsure what the breaking change was (the label check?).

Some packages keep a CHANGELOG.md with short summaries, please consider doing this.

Warn OptionalArgChecks.jl's scoping rule?

IIUC, the effect of @skipargcheck is dynamically scoped:

using OptionalArgChecks
@noinline f(x) = @argcheck x > 0
@noinline g(x) = f(x)
h(x) = @skipargcheck g(x)
h(-1)  # no error

That is to say, @skipargcheck is effective no matter how far away the function using @argcheck is in the call chain. This is very different from @inbounds as it works only with inlined calls (i.e., @inbounds scoping is more-or-less lexical). On the other hand, there is no way for a callee to reliably throw an exception when using @argcheck. I understand that exception is not used as "output" in Julia most of the time. However, you can find in some places exception type is crucial (e.g., NLsolve.jl, Optim.jl).

I do think OptionalArgChecks.jl is a very interesting approach to optional error handling. But, if my understanding of its scope is correct, I think it's better to have a warning on its scoping rule. Ideally, I think it's better to have a separate macro for enabling OptionalArgChecks.jl.

cc @simeonschaub

reg

@JuliaRegistrator register()

Doc suggestion

Readme/doc improvement suggestion: explain why @argcheck is "better" than @assert for method arguments. Thanks!

I came here via here.

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

doesn't work with error constructors which take no (string) argument

julia>  @argcheck false DomainError
ERROR: MethodError: Cannot `convert` an object of type String to an object of type 
DomainError                                                                       
This may have arisen from a call to the constructor DomainError(...),
since type constructors fall back to convert methods.
 in build_error(::Bool, ::Type{DomainError}) at /home/tamas/.julia/v0.5/ArgCheck/sr
c/ArgCheck.jl:7                                                                   

chained == comparisons don't work

julia> using ArgCheck

julia> x = y = z = 1
1

julia> x == y == z
true

julia> @argcheck x == y == z
ERROR: MethodError: objects of type Int64 are not callable

better error message

using ArgCheck
A = Int
B = Float64
@argcheck A <: B
ArgumentError: A <: B must hold.

Error handling unicode comparison chars?

function f(x)
       @argcheck x ≥ 0
       x
end
julia> f(-2)
ERROR: ArgumentError: x ≥ 0 must hold. Got
≥ => >=
x => -2

Notice the line with the ≥ => >=.

This seems to be an issue with the unicode greater-than-or-equal symbol. Indeed, if I define instead

julia> function f(x)
       @argcheck x >= 0
       x
end

The error prints fine

julia> f(-2)
ERROR: ArgumentError: x >= 0 must hold. Got
x => -2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.