iamed2 / ResultTypes.jl

A Result type for Julia—it's like Nullables for Exceptions
Other
95 stars 8 forks source link

avoid specializing `convert` for `Any` result types #25

Closed stev47 closed 3 months ago

stev47 commented 1 year ago

Specializing convert(Result{Any, E}, x) for every type of x can incur substantial compilation overhead (not only on convert but also on Some). This change avoids specializing in case of explicit Any result type.

This is analogous to Julia Base where we have

convert(::Type{Any}, Core.@nospecialize x) = x

to avoid excessive specialization.

0x0f0f0f commented 3 months ago

Superseded by #27