Giter VIP home page Giter VIP logo

Comments (6)

Keno avatar Keno commented on August 16, 2024 9

IIRC @vtjnash said this was intentional, but there was much complaining from pretty much anyone, so I think we need to think about this again, possibly by tweaking the display code to only display methods that are reachable in the current world.

from julia.

christiangnrd avatar christiangnrd commented on August 16, 2024

Bisected to #53415

from julia.

Keno avatar Keno commented on August 16, 2024

How about the following: We change the display code to only count methods which are reachable in the current world for some signature. Now, I don't believe we have that exact query in the type system, but I think something along the lines of typesubtract(m.sig, mapreduce(m2->m2.sig, Union, filter(!=(m), methods(m.sig)) !== Union{} would be pretty close. It's a little expensive to compute, but probably doesn't matter for interactive showing.

from julia.

vtjnash avatar vtjnash commented on August 16, 2024

I don't believe we have that exact query in the type system

It is exactly the query you get if specifying lim != -1, though it indeed is expensive. Of note though that this can be approximated quite well with a O(1) pair-wise check (and which is an exact if there is no ambiguities), as two type-egal methods must be adjacent in the output list, per the definition of morespecific, after filtering ambiguities.

from julia.

JeffBezanson avatar JeffBezanson commented on August 16, 2024

This also seems unexpected:

f() = 1
f() = 2

julia> methods(f, Tuple{})
# 1 method for generic function "f" from Main:
 [1] f()
     @ REPL[15]:1

julia> methods(f, Tuple{Vararg{Any}})
# 2 methods for generic function "f" from Main:
 [1] f()
     @ REPL[15]:1
 [2] f()
     @ REPL[14]:1

from julia.

vtjnash avatar vtjnash commented on August 16, 2024

The behavior of lim==-1 has always been that way for whether it chooses to filter out supertypes. I suppose because it happens to be O(n) whereas the filter for the general case is O(n^3), where n is the number of methods that matched

from julia.

Related Issues (20)

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.