Hi - thanks for responding - updated the above - I hadn’t removed the other subtypes from the listing.
As to the usage - it’s supported by Structypes.jl and I make use of it to facilitate multiple dispatch of computations (and filters) provided by users to an http endpoint on top of a calculation library.
i.e. Percentiles require percentile arguments but Average / Sum wouldn’t but they are both of type “ICompute”. The above snippet was / is working fine until I introduced “IQuery”, resulting in the error thrown.
Incidentally - I saw your contribution here and this StructTypes + Interface approach would potentially be applicable (I would post it if it worked…), since the OP is essentially making use of properties of a type rather than the type, with a default required for the generic: implying a conversion step on raw data (JSON?) to a type (or not) and an implementation of that method for the converted type to support multiple dispatch.
Like this:
#support calcs that allow streaming:
#default - fall through
streamingUpdate!(compute:: ICompute, value) = ()
function streamingUpdate!(ave:: Average, value)
if(ismissing(value)) return end
ave.runningTotal += value
ave.runningCount += 1
end
function streamingUpdate!(sum:: Sum, value)
if(ismissing(value)) return end
sum.runningTotal += value
end
Regards,