-
-
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
show(o::Any) handles circular references #3831
Conversation
bump Is this still relevant for 0.2-rc1? |
Now that we're past 0.2, it would be good to revisit this. |
Bump. This would be good to have for 0.3 (and this PR has been open a long time...) |
Ok, let's rebase this, kick the tires, and see if we like it. |
Ok, I'm playing around with this. The original from this PR is: In [2]: type A
b
end
In [3]: type B
a::A
function B()
self = new()
self.a = A(self)
self
end
end
In [4]: b = B()
Out [4]: B(A(B(# oid 2006584968323742060))) I don't think showing the object id tells you much, how about something like: In [14]: show2(B())
B(A(B(#= circular reference =#))) |
Python uses
|
Whereas we could use ⥀ or the like. |
Rebased. Uses all 3 of ⥀, But I am neutral to any representation. Just thought that the object id may help in multiple circular references. |
I still vote for In [14]: show2(B())
B(A(B(#= circular reference =#))) Very clear that something different is happening (in the case you accidently create a circular reference). And it uses a |
Have changed it to |
+1 |
show(o::Any) handles circular references
Stdlib: Pkg URL: https://github.com/JuliaLang/Pkg.jl.git Stdlib branch: master Julia branch: master Old commit: e7d740ac8 New commit: 56c379045 Julia version: 1.12.0-DEV Pkg version: 1.11.0(Does not match) Bump invoked by: @KristofferC Powered by: [BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl) Diff: JuliaLang/Pkg.jl@e7d740a...56c3790 ``` $ git log --oneline e7d740ac8..56c379045 56c379045 make `delayed_delete_dir` usage a bit more backwards compatible (#3830) 5a68d7953 restore unwrap UnstableIO in precompile (#3831) ``` Co-authored-by: Dilum Aluthge <[email protected]>
…#53637) Stdlib: Pkg URL: https://github.com/JuliaLang/Pkg.jl.git Stdlib branch: master Julia branch: master Old commit: e7d740ac8 New commit: 56c379045 Julia version: 1.12.0-DEV Pkg version: 1.11.0(Does not match) Bump invoked by: @KristofferC Powered by: [BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl) Diff: JuliaLang/Pkg.jl@e7d740a...56c3790 ``` $ git log --oneline e7d740ac8..56c379045 56c379045 make `delayed_delete_dir` usage a bit more backwards compatible (JuliaLang#3830) 5a68d7953 restore unwrap UnstableIO in precompile (JuliaLang#3831) ``` Co-authored-by: Dilum Aluthge <[email protected]>
This small patch specifically only handles the looping associated with self-referential compound types which do not have a
show
method.It is a temporary fix till the larger issues of a better
show
is available. Works by recording already printed objects in a task local Set.Will be useful for new user defined types with self-referential objects that do not have a
show
method.