Skip to content

Conversation

@topolarity
Copy link
Member

This is a revival of #40652, to remove spurious reasons that --trace-compile output does not eval properly right now (I don't know if we'll be able to fix all of the flaws, but it seems worthwhile to fix the easy cases so that we can focus on the hard ones)

The default REPL printing does not think it's worth printing these field names:

julia> struct Foo
           x::Int
           y::Int
           z::Int
       end

julia> Foo(1,2,3)
Foo(1, 2, 3)

so I'm not sure why our static_show would find it necessary.

@topolarity topolarity requested a review from vtjnash June 3, 2025 20:12
@topolarity
Copy link
Member Author

@vtjnash if you really want these field names and also don't want them printed as a comment (e.g. Foo(#= x =# 1, #= y =# 2, #= z =# 3)), I'll happily add this as a printing option in the config / context

@vtjnash
Copy link
Member

vtjnash commented Jun 3, 2025

Debugging relies very heavily on these field names, so NAK any removal of them (it also makes the correct version of precompile worse, since it can no longer use those comments to try to construct the new object correctly)

@topolarity
Copy link
Member Author

Any complaint if they are printed as comments?

@topolarity topolarity changed the title static_show: Don't print field names of structs static_show: Don't print field names of structs in --trace-compile output Jun 3, 2025
@topolarity
Copy link
Member Author

Added a config option. jl_ now prints:

julia> ccall(:jl_, Cvoid, (Any,), Foo(1,2,3))
Main.Foo(#= x =# 1, #= y =# 2, #= z =# 3)

And --trace-compile prints:

precompile(Tuple{typeof(Main.foo), Base.Val{Main.Foo(1, 2, 3)}})

@vtjnash
Copy link
Member

vtjnash commented Jun 4, 2025

Eh, it looks worse and makes implementing the good version much harder, but it is valid

Also tweak the printing of field names to use comments:
"Foo(#= x =# 1, #= y =# 2, #= z =# 3)"
@topolarity topolarity force-pushed the ct/staticshow-no-fieldnames branch from 1670cd4 to 70cc74d Compare June 4, 2025 14:12
@topolarity
Copy link
Member Author

@vtjnash Some time has passed and I still think we need to print accurate types to the user for --trace-compile

If you'd like to make the precompile(...) de-serializer type-imprecise, I'm fine with that but I think it needs to done on the de-serializer side. It's just too valuable to have a precise serializer to report types to the user

I'll merge this in the next day, unless you have any objections.

@vtjnash
Copy link
Member

vtjnash commented Jun 17, 2025

I still object to this process of making our serializer less correct and worse implemented instead of fixing our deserializer design problems

@vtjnash vtjnash closed this Sep 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants