Giter VIP home page Giter VIP logo

Comments (1)

goretkin avatar goretkin commented on June 8, 2024

I'm trying to find a situation where this makes a difference. I understand the closure argument, and interestingly enough it's different for division on Integer vs subtraction on Unsigned -(::T)::T where T <: Unsigned, but inv(::Int)::Float64. But a concrete example where this is happening would help.

julia> 0x00ff + -(0x01)
0x01fe

julia> 0x00ff - 0x01
0x00fe

julia> n(x) = zero(x) - x
n (generic function with 1 method)

julia> n(0x01)
0xff

julia> n(0x0001)
0xffff

I wonder if you looked at something like

julia> struct A <: Number
       end

julia> -(A(), A())
ERROR: - not defined for A
Stacktrace:
 [1] error(::String, ::String, ::Type{T} where T) at ./error.jl:42
 [2] no_op_err(::String, ::Type{T} where T) at ./promotion.jl:383
 [3] -(::A, ::A) at ./promotion.jl:386
 [4] top-level scope at none:0

and read the error message as implying that there is a fallback on -(::A). There isn't, I just think the message is a bit misleading: https://github.com/JuliaLang/julia/blob/04e47cf5ff95daf887808f52b96d79ae03b1942a/base/promotion.jl#L387

from radical-julia.

Related Issues (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.