Giter VIP home page Giter VIP logo

Comments (3)

nsajko avatar nsajko commented on May 12, 2024

Perhaps better example:

julia> module A
         setproperty!(x) = x
       end
Main.A

julia> A.setproperty! == setproperty!
false

julia> module B
         const c = setproperty!  # just use it
         setproperty!(x) = x
       end
ERROR: invalid method definition in B: function Base.setproperty! must be explicitly imported to be extended
Stacktrace:
 [1] top-level scope
   @ none:0
 [2] top-level scope
   @ REPL[3]:3

from julia.

jakobnissen avatar jakobnissen commented on May 12, 2024

This is intentional and an explicit feature of the languag. Base functions can be shadowed, if they haven't been referred to before.
One major advantage of this is that it allows Base to export new symbols without breaking existing code, while also preventing Base from monopolizing a huge number of names.

from julia.

Tortar avatar Tortar commented on May 12, 2024

indeed this is a great feature...my case was specifically referred to the help search side effect which can be a bit surprising, but, at the same time, it makes sense because if you search for a name, it is much more likely that you want to extend it than if you don't do so. So, I guess it is a good default

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.