@cart says:
The redundant work in validate_param, which is done immediately before get_param never felt great to me. This isn't a problem exclusive to Res/ResMut, but it is certainly present.
I think doing validation as part of get_param is more defensible from a performance perspective.
I think it is worth doing some benchmarks where we skip validation (as-in, across all SystemParams), just to see what price we're paying here.
IMO the best way to restructure this would be to have get_param return a Result<Self::Item, SystemParamValidationError>, effectively combining the signature with validate_param.
@cart says:
IMO the best way to restructure this would be to have
get_paramreturn aResult<Self::Item, SystemParamValidationError>, effectively combining the signature withvalidate_param.