We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Consider the difference between these two function definitions
julia> Base.sum() = 1 julia> foo() = 1 foo (generic function with 1 method)
Should the method extension here return the sum function? I think it would be nice if the example above instead behaved like:
sum
julia> Base.sum() = 1 sum (generic function with 16 methods)
Amusingly this is actually causing a doctest failure.
The text was updated successfully, but these errors were encountered:
I think the displaying is:
julia/base/show.jl
Lines 34 to 41 in 96147bb
but I can't figure out what controls what to return when we have a statement like
julia> Base.sum() = 1
Sorry, something went wrong.
It is part of lowering (see return *):
return *
julia> Meta.@lower Base.x() = 1 :($(Expr(:thunk, CodeInfo( @ none within `top-level scope` 1 ─ %1 = Base.getproperty(Base, :x) │ %2 = Core.Typeof(%1) │ %3 = Core.svec(%2) │ %4 = Core.svec() │ %5 = Core.svec(%3, %4, $(QuoteNode(:(#= REPL[1]:1 =#)))) │ $(Expr(:method, nothing, :(%5), CodeInfo( @ REPL[1]:1 within `none` 1 ─ return 1 ))) └── return nothing )))) julia> Meta.@lower x() = 1 :($(Expr(:thunk, CodeInfo( @ none within `top-level scope` 1 ─ $(Expr(:thunk, CodeInfo( @ none within `top-level scope` 1 ─ return $(Expr(:method, :x)) ))) │ $(Expr(:method, :x)) │ %3 = Core.Typeof(x) │ %4 = Core.svec(%3) │ %5 = Core.svec() │ %6 = Core.svec(%4, %5, $(QuoteNode(:(#= REPL[2]:1 =#)))) │ $(Expr(:method, :x, :(%6), CodeInfo( @ REPL[2]:1 within `none` 1 ─ return 1 ))) └── return x ))))
No branches or pull requests
Consider the difference between these two function definitions
Should the method extension here return the
sum
function? I think it would be nice if the example above instead behaved like:Amusingly this is actually causing a doctest failure.
The text was updated successfully, but these errors were encountered: