[1] https://juliainterop.github.io/RCall.jl/stable/gettingstarte...
[2] https://github.com/JuliaInterop/Cxx.jl
[3] https://www.queryverse.org/Query.jl/stable/linqquerycommands...
Expression BrainFuck(string code) => Expression.Constant(42); // parser would go there
var bfFunc = BrainFuck(@"arbritrary code").Compile();
WriteLine(bfFunc(someArg)); // <- prints 42
As I mentioned later the difference appears to be that Julia does `Compile` call at compile time, thus giving you build-time validation.P.S. this exact code won't work, but it shows the idea.
i guess all the macro stuff is under System.Linq.Expressions because LINQ expressions like
from score in scores
where score > 80
select score
aren't just for SQL and can desugar to arbitrary C# code, is that right?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.
Not sure fully grokked it, but the difference appears to be, that in Julia the final Julia code is checked by the compiler at compile time?