You can store basic expressions in layer names and use eval() in the actual layer. For example name a layer with this:
x=Math.PI; y=2; z=thisLayer.width
Then create a text layer and put this as the expression in the “source text”:
myLayer = thisComp.layer("x=Math.PI; y=2; z=thisLayer.width");
eval(myLayer.name);
x*y+z
Unfortunately, I don’t think it goes beyond numbers and simple expressions. You can only use “thisLayer” as well–no referencing other layers. Plus layer names don’t update as well as you’d like when you change the expression.
Another option is to use scripts:
Zorro the Layer Tagger combined with Expression Toolbox from aescripts.com
Dan Fredley