#Metaprogramming via scripting
- Brilliant sample from 'Metaprogramming in .Net' book
- Scripting: Roslyn CTP vs. IronPython
- ScriptCS
eval()
-like - Roslyn CTP: scripting and results as
dynamic
- IronPython: scripting, DLR and results as
dynamic
#Dynamically generating .Net assembly at runtime
- Roslyn CTP: build and load assembly in memory
- CodeDOM
- build and load assembly in memory
- C# 4.0 and 5.0 features, not supported by Roslyn CTP yet
#Metaprogramming via runtime code generation
- Hardcoded C# rule: ~900ms to run 1000 iterations
- Roslyn CTP: scripting and statically typed results: ~950ms to run 1000 iterations
- DLR i.e. Dynamic Language Runtime with ExpressionTrees: ~1200ms to run 1000 iterations
#Code-as-Data approach
- Roslyn CTP convert VB → C#, and back
- Roslyn CTP and T4
- Runtime template transformation using T4
- Generate types, models and algorithms from JSON input using Roslyn CTP
#Introspection
- Roslyn CTP: Calculate code complexity
- Roslyn CTP: search for
return null;
. - Using
System.Reflection
to limit dependencies of assemblies
#Nemerle: compile-time macro
- Nemerle macro: compile- with run- time execution