ConcurrentCollections.jl: "lock-free" dictionary, queue, etc. for Julia 1.7

I don’t think there’s any established guideline. I just used what I thought least confusing (i.e., treating Union{Some,Nothing} as a maybe value). But, in fact, there are a few recent discussions in Julia around this

It’s also nice to go beyond the “maybe” APIs. When you use concurrent data structures, it’d be nice to have a low-level API that tells you why certain operations failed (empty collection? contention? locked?). Throwing an exception is too slow in a tight loop but there’s no established convention for the success/error sum type. There are ErrorTypes.jl, ResultTypes.jl, and Expect.jl but, IIRC, none of them seem to try to exploit union-split capability in Julia which is rather unfortunate (although there are of course legit reasons why you don’t want to use Union). Ref: [ANN] ErrorTypes.jl - Rust-like safe errors in Julia

1 Like