Can I make a TSL uniform node specific to a material, and not global?

Let’s say I have a simple TSL node like this:

const goGreen = tsl.uniform(0);
const myTslNode = tsl.Fn(() => { 
    const n = tsl.vec4().toVar();
    tsl.If(goGreen.equal(1), () => {
        n.assign(tsl.vec4(0, 1, 0, 1));
    }).Else(() => {
        n.assign(tsl.vec4(1, 0, 0, 1));
    });
    return n;
})();

My question is, how can I make myTslNode reusable in multiple different materials? Right now, if I try to use myTslNode in multiple materials, then every time I update the goGreen uniform’s value (for example goGreen.value = 0), it will update it for all the materials I am using goGreen in. I would like the goGreen uniform to be material-specific, not global.

This way, I don’t have to duplicate the same node for every material I use it in.

Theoretically this could be supported, if I could create a “uniform of a uniform”. Instead of directly providing myTslNode with the goGreen node, we would provide it with a uniform that resolves to another uniform, where each “inner” uniform would be the material-specific uniform that resolves to 1 or 0.

Wouldn’t it be easier then for the function to take a parameter?

let shaderMode;

const myShader = Fn(() => { 
	If( shaderMode.equal(0), () => {
		//some TSL code here
	})

	.ElseIf( shaderMode.equal(1), () => {
		//some TSL code here
	})
})();

const outputA = Fn(() => { // first variation
	shaderMode = uniform(0);
	const result = myShader;
	return result;
})();

const outputB = Fn(() => { // second variation
	shaderMode = uniform(1);
	const result = myShader;
	return result;
})();

materials[0].colorNode = outputA;
materials[1].colorNode = outputB;

Something like this?
Here the main code (myShader) is written only one time, but three.js will compute two shaders using different uniforms for the outputs.

This is one of the cool feature of TSL, you can combine reuse and nest as many Fn functions you want to create infinite twisted shenanigans.