Skip to content

Conversation

@topolarity
Copy link
Member

before:

julia> ccall(:jl_, Cvoid, (Any,), Char('u'))
Char(0x75000000)

after:

julia> ccall(:jl_, Cvoid, (Any,), Char('u'))
reinterpret(Char, 0x75000000)

I know that @vtjnash has advocated for us to provide a custom de-serializer, but I think the mental burden for users to have to worry about types that look eval-able (and frequently are) but in practice need a custom de-serializer is too much.

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

vtjnash commented Jun 3, 2025

I really dislike the implication here that a printed Char is an instance of the reinterpret struct. This introduces an ambiguity into our serialization format which I don't think is a good idea

@topolarity
Copy link
Member Author

I can spell this as Base.reinterpret - the ambiguity is no worse than resolving any other TypeName IMO.

@vtjnash
Copy link
Member

vtjnash commented Jun 3, 2025

Both of those mean you have an instance of the reinterpret struct for debugging, which is not what it means

@topolarity
Copy link
Member Author

Both of those mean you have an instance of the reinterpret struct for debugging, which is not what it means

This PR is changing that definition

@topolarity topolarity force-pushed the ct/reinterpret-char branch from a7700cd to 76b2994 Compare June 3, 2025 21:02
@topolarity topolarity force-pushed the ct/reinterpret-char branch from 76b2994 to 3de7e15 Compare June 4, 2025 01:10
@JeffBezanson
Copy link
Member

It sounds like we have not decided whether to print an eval-able (or close to it) expression here or use a different new text-based serialization format.

@topolarity
Copy link
Member Author

It sounds like we have not decided whether to print an eval-able (or close to it) expression here or use a different new text-based serialization format.

Yeah.. I think the heart of the conflict is whether we have a precise serialization (i.e. recoverable to an exact type) and then imprecise de-serialization (i.e. guesstimate when picking a 'close enough' type to map back to as a pre-compile hint), or if we instead have an imprecise serializer to begin with (that throws out / approximates type information before it even gets to --trace-compile)

I feel that we lose a lot of valuable introspection when --trace-compile starts to lie / approximate types for you, so I would really like to do the first thing and have something that can serialize / print a type for the user exactly.

The imprecise version just seems like it's asking for a ton of confusion when it comes time to investigate unexpected compilation, etc.

@vtjnash
Copy link
Member

vtjnash commented Jun 17, 2025

Yes, exactly why I think this PR is bad, since it implies that our serializer is no longer intended to be a correct and precise output, but is rather that there are supposed to be various arbitrary heuristics during (de)serialization to guess what calling various random functions in various random packages (such as Pkg.reinterpret) do when executed or constructed

@topolarity
Copy link
Member Author

topolarity commented Jun 17, 2025

Yes, exactly why I think this PR is bad, since it implies that our serializer is no longer intended to be a correct and precise output, but is rather that there are supposed to be various arbitrary heuristics during (de)serialization to guess what calling various random functions in various random packages (such as Pkg.reinterpret) do when executed or constructed

That's an exaggeration IMO

It reserves exactly one fully-qualified (non-)typename Base.reinterpret to have special meaning in the serializer / de-serializer.

@topolarity topolarity changed the title static_show: Print primitive types with reinterpret(...) static_show: Print primitive types with Base.reinterpret(...) Jun 17, 2025
@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.

3 participants