Re:Six Months with Julia: Parse-Time Transpilation in 80 Lin...
by lostmsu on Friday April 10, 2020 @10:18AM
(#22833254)
I think they are limited quite a bit. E.g. do not support classes, latest C# features, etc.
They were made exactly for SQL among other things. With SQL target your example will use this feature: scores will be IQueryable, and "IQueryable.Where" will take Expression, which C# compiler will generate from "score > 80" during compilation. Then the specific database engine will convert that "Expression" instance to SQL query for execution.
Of course, there are other ways to generate more .NET code at runtime. But not at compile time, which I wish we had.
They were made exactly for SQL among other things. With SQL target your example will use this feature: scores will be IQueryable, and "IQueryable.Where" will take Expression, which C# compiler will generate from "score > 80" during compilation. Then the specific database engine will convert that "Expression" instance to SQL query for execution.
Of course, there are other ways to generate more .NET code at runtime. But not at compile time, which I wish we had.