-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
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
Clarify what "no program" means in egal docs #54887
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -341,6 +341,16 @@ false | |
julia> a === a | ||
true | ||
``` | ||
|
||
# Extended help | ||
It might be possible to construct a program that is actually able to distinguish | ||
two egal values. For example, one could heap-allocate two integers, | ||
then compare the value of a pointer pointing to their heap address. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure how to realize that example with "heap allocated integers". How about talking about strings instead, were this is quite easy to demonstrate in practice? E.g. julia> a = "x" ; b = "x" ; a === b
true
julia> pointer_from_objref.([a,b])
2-element Vector{Ptr{Nothing}}:
Ptr{Nothing} @0x000000010cf60748
Ptr{Nothing} @0x000000010cf60780 |
||
However, all such programs rely on observing behaviour outside Julia's allowed | ||
semantics, and so happen to work due to implementation details and/or triggering | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reading this my first thought was: What are "Julia's allowed semantics", and where can I find out more. I.e.: To me this doesn't clarify much. Mainly I am left with this message: "You can't distinguish egal values by the rules, which I am not telling you, just so you know: if you found a way it is cheating and you should not rely on it in any way." But is that really helpful? Honest open question, I don't know. Since you opened the PR, presumably you feel this text (or at least parts of it) would have been helpful for you to know when you run into this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a fair summary. On the other hand, the current message is "you can't distinguish egal values", which is just false - you absolutely can, e.g. by comparing pointers to strings, as you did in the example above. So, I think either that statement should be removed from the docs, or else it should be properly explained what it means. |
||
undefined behaviour. | ||
In the example, it is invalid to assume that a value on the heap has a single | ||
unique pointer referencing it, and that any such pointer references no other value. | ||
""" | ||
=== | ||
const ≡ = === | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not an idea formulation because the program doesn't actually distinguish two egal values.