How to add a property for all custom structs?

It’s often a good idea to extend functionality like this. You might be interested in the @forward macro from the Lazy.jl package.

Also be careful of your types here, you might not get specialisation due to the abstract type. Consider using a generic:

struct NormalizedMine{T<:AbstractMine,Q}<:AbstractMine
    nn::T
    normalization_factor::Q
end

You don’t need the Q type, especially if you know the concrete type already.

2 Likes