The largest hurdle towards using PSLambda for anything outside of interactive use is lack of ability to debug. From a glance it doesn't look easy. The LambdaExpression.Compile method does take a DebugInfoGenerator object as a parameter, but it looks like that can only mark sequence points for LambdaExpressions. In a quick search I haven't found a way to use the DebugInfoExpression throughout the expression tree.
A last resort would be to implement my own stack spiller and translate the expression tree into IL. As much as I would absolutely love to do that, maintainability would be quite difficult. That would however also make some things like async/await, class definitions, and yield enumerables significantly easier to implement.
All of that assumes that the C# vscode extension can even handle being directed at a .ps1 file.
The largest hurdle towards using PSLambda for anything outside of interactive use is lack of ability to debug. From a glance it doesn't look easy. The
LambdaExpression.Compilemethod does take aDebugInfoGeneratorobject as a parameter, but it looks like that can only mark sequence points forLambdaExpressions. In a quick search I haven't found a way to use theDebugInfoExpressionthroughout the expression tree.A last resort would be to implement my own stack spiller and translate the expression tree into IL. As much as I would absolutely love to do that, maintainability would be quite difficult. That would however also make some things like
async/await, class definitions, andyieldenumerables significantly easier to implement.All of that assumes that the
C#vscode extension can even handle being directed at a.ps1file.