Generically, is it better to use a script or an expression when performing a transform in Perspective? In most cases I can use either one, but my personal preference is scripts. Is there a reason why I should be using an expression if possible? Is it faster? Does it handle multithreading better? Is there another reason for one over the other?
The most current example is I'm trying to set a button visibility based on the user role. I've bounded the role to the visibility property but then need to transform it to a Boolean value using an if statement. Does it matter what type of transformation I use for this?
Generally, avoid transforms if possible, and default to pure expressions.
You can not do multithreading in expressions. There are certain applications which the expression language is not capable of, in those cases you will need to use scripts.
This is a perfect example of when you don't even need a transform at all.
Just use a pure expression binding.
hasRole('role')
For more perspective performance infomation see this thread: