dotnet / dotNext

Next generation API for .NET
https://dotnet.github.io/dotNext/
MIT License
1.6k stars 119 forks source link

Compile time codegen? #2

Closed dzmitry-lahoda closed 5 years ago

dzmitry-lahoda commented 5 years ago

Via https://github.com/ltrzesniewski/InlineIL.Fody/issues/6 ? Or msbuild task with roslyn code generator?

sakno commented 5 years ago

Gist with proposal was created to continue discussion in task Type Classes and it is not directly related to DotNext.Reflection library. It was specified as a proof of concept that type classes can be introduced into language without CLR modifications because the library already contains support of concept types based on mix of reflection (for binding) and delegates (for method calls). The LDM team responsible for Roslyn compiler offers different implementation of concept types using witness structures.

The current implementation of concept types in .NEXT based on invocation of delegates which have equal performance to calli instruction or direct method call. Look at the benchmarks. Therefore, I don't see any reasons to use InlineIL library and replace delegate invocation with calli instruction.