Skip to content

Conversation

@aplavin
Copy link
Contributor

@aplavin aplavin commented Dec 4, 2025

Basically, for convenience: I find myself copy-pasting these methods whenever I load/store Julia serialized data as part of another data format like parquet or sql database. They natively store byte arrays, and would be nice to have these (de)serialize methods going directly back and forth between Julia objects and byte vectors.

Another neat usecase is to quickly copy-paste a Julia object between different Julia sessions (repls, notebooks, remote, ...):

# in session 1:
x |> serialize |> base64encode
# copy the resulting string

# in session 2:
x = "<paste string here>" |> base64decode |> deserialize

@JeffBezanson
Copy link
Member

Looks good. Would be nice to add doc strings to these.

Copy link
Member

@LilithHafner LilithHafner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I've also wanted this functionality. There's no other plausible implementation of the deserialize(::Vector{UInt8}) method, and the return type Vector{UInt8} seems reasonable for the serialize(value) method.

Should go to triage as it is technically an expansion of public API? The specific question I'd ask is: "Is Vector{UInt8} the right return type for serialize(value)?"

@JeffBezanson
Copy link
Member

I think we can just merge this. What is the mac build failure here about?

@adienes
Copy link
Member

adienes commented Dec 12, 2025

is there a reason the docs enforce specifically a Vector{UInt8} from serialize rather than an iterator over UInt8 ? it's quite rare one needs indexed access to serialized data, right?

for deserialize it makes sense to not promise more than is implemented, but I don't think these need to be perfectly symmetric

See [`deserialize(::IO)`](@ref deserialize(::IO)) for more details and caveats.
!!! compat "Julia 1.13"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
!!! compat "Julia 1.13"
!!! compat "Julia 1.14"

See [`deserialize(::IO)`](@ref deserialize(::IO)) for more details and caveats.
!!! compat "Julia 1.13"
This method is available as of Julia 1.13.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This method is available as of Julia 1.13.
This method is available as of Julia 1.14.

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.

4 participants