Giter VIP home page Giter VIP logo

Comments (3)

oscardssmith avatar oscardssmith commented on May 25, 2024 1

those effects are just because you haven't told it what the symbol is.

julia> f(x) = x.body
f (generic function with 1 method)

julia> Base.infer_effects(f, (Type{TT1},))
(+c,+e,!n,+t,+s,+m,+u)

from julia.

oscardssmith avatar oscardssmith commented on May 25, 2024

it's much weirder than that.

julia> objectid(TT1)
0xda12ac8fd4db99e3

julia> objectid(TT2)
0xda12ac8fd4db99e3

julia> objectid(TT2.body)
0x0d495eccbd8d7532

julia> objectid(TT1.body)
0xa84320db54f6eb75

from julia.

topolarity avatar topolarity commented on May 25, 2024

That behavior seems required by the doc-comment for objectid:

help?> Base.objectid
  objectid(x) -> UInt

  Get a hash value for x based on object identity.

  If x === y then objectid(x) == objectid(y), and usually when x !== y, objectid(x) != objectid(y).

  See also hash, IdDict.

So your observation is just that:

julia> TT1 === TT2 && TT1.body !== TT2.body
true

which I do find intuitively very surprising as a definition for egality.

It certainly disagrees with the statement that "no program can distinguish x and y, if x === y", and it seems to imply that === is not sufficient for inlining/substituting an object in IR - you have to also prove that it is used only :consistent-ly.

But the effects are at least correct in that case:

julia> Base.infer_effects(Core.getfield, (Type{TT1}, Symbol))
(!c,+e,!n,+t,+s,+m,+i)

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.