Material Functions as Parameters

I have a material containing a function. I would like for instances of this material to use a function of their choosing. Is this possible? What is a workaround if not?

(The function I’m using is for creating layered materials–so say I have a block with some sort of coating. I’d like instances to be able to specify whether it’s painted coating or metal coating or whatever.)