News for hackers. Stuff that matters.
Re:Some Memories of Niklaus Wirth by Martin Odersky by pjmlp on Wednesday January 17, 2024 @07:37AM (#39026880)
You already get them with code generators and Rosylin, but it is a bit painful to use.
Re:Some Memories of Niklaus Wirth by Martin Odersky by SideburnsOfDoom on Wednesday January 17, 2024 @08:46AM (#39027583)
There is also a new compiler feature, "interceptors" that swaps in calls at compile-time. https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/cs...

This looks very hard to use well, but that's because "it's not for you" to use directly in app code, rather it's a low-level building block for such AOT and code generation patterns and toolkits.

Re:Some Memories of Niklaus Wirth by Martin Odersky by pjmlp on Wednesday January 17, 2024 @09:10AM (#39027866)
I hate it, as it is a bad approach to what should have been a proper AOP framework like PostSharp or Microsoft Fakes.

Instead we will end with a special cased mini framework, designed to override reflection code for the purposes of AOT code generation.

Something that AOT toolchains for Java have solved much better with agents, PGO and config files.

From my point of view, it is neither a good approach to sort that out, nor a good AOP alternative.

Re:Some Memories of Niklaus Wirth by Martin Odersky by gfraiteur on Thursday January 18, 2024 @02:15PM (#39046246)
Agreed. Roslyn analyzers, code generators, refactoring providers and other extension points are not designed for application developers but are rather building blocks.

We built a code generation and analysis framework based on these Roslyn extension points. It's called Metalama: https://doc.postsharp.net/metalama.