-
Notifications
You must be signed in to change notification settings - Fork 47
Description
For Soss.jl I'm moving toward all MCMC results being in the form of iterators. Currently, sample returns a pair (samples, stats), which is a bit awkward to work with.
It seems like this is a general problem: we have a value we're interested in (here a single sample) that has some metadata associated with it. We don't always want to throw away the metadata, but we don't want it to get in the way.
This seems like the exact problem addressed by MacroTools.jl's @forward macro.
For example, there could be a (maybe general-purpose) Meta struct with
struct Meta{T,S}
value :: T
meta :: S
endwith methods for common functions @forwarded to the .value field. A new method for sample could then return an iterator of Metas. This could be really convenient - the metadata is there is you need it, but stays out of the way for computations.
What do you think?