Hi, In looking at how Julia packages are implemented, I see a common idiom that I don’t quite understand. For example, if you look at YaoBase/src/YaoBase.jl at https://github.com/QuantumBFS/YaoBase.jl/blob/master/src/YaoBase.jl you see
using YaoAPI
import YaoAPI: isunitary, isreflexive, iscommute,
AbstractRegister, AdjointRegister, AbstractBlock,
PostProcess,
NotImplementedError, LocationConflictError, QubitMismatchError,
instruct!, focus!, relax!, nqubits, nremain, nactive, nbatch,
viewbatch, addbits!, insert_qubits!, measure, measure!,
occupied_locs, invorder!, partial_tr, select!, ρ, reorder!
Looking at the Julia docs at Modules · The Julia Language , I see that the using YaoAPI
makes all functions accessible (even non-exported ones with YaoAPI.fcnName) and also makes them extensible. As far as I know, all that the long import statement does is allows for use of non-exported functions from YaoAPI without the YaoAPI.
prefix. So it’s just convenience.
Is that really right or is there more going on here? I’ve started writing my own packages, so I’m wondering what I’m missing, if anything.
Thanks in advance for explanations! – Adam