You can always assign an expression to an expression-controller like a slider on a null,
then other expression reference that slider, and they will get the calulated value.
There is no way to set the value of the slider from outside of that slider’s expression, so you can have the expression for opacity store a value in a slider.
So you have to think the other way around, and do all calculations in the sliders’ expression.
As per the text-expressions, you can assign an expression to the source-text value of a text-layer, if the outcome of that expression is a number or more importantly a string, it will be displayed.
You can do this for an invisible text-layer and have another layer reference that value. Also, you can store different texts in different keyframes and then retrieve the values of those keys.
What exactly do you want to achieve, because this is just theoretical and very general, there may be other ways around your problem.