Re:Twenty years of C# with Anders Hejlsberg [audio]
by VincentEvans on Thursday February 10, 2022 @05:31PM
(#30293650)
Last time I used Java, it looked to me that AOP is supported with compile-time byte-code rewriting, which might explain why it may feel like magic and be hard to debug. .Net also has a IL-rewriting 3rd party toolkits that enable AOP, namely Postsharp - but my experience with it wasn’t great for similar reasons you stated. Maybe I did something incorrectly, but my impression of tools that generate code at compile time - is that you can’t step through the resulting code. Python on the other hand is both flexible and simple. The decorator code simply wraps the function it decorates (you get a lambda variable that will contain the function you annotate, so you do whatever it is you need to do, and then call the original function. Or not, your choice. ) and doesn’t feel complicated at all. Debugging is simple.
Try it and you might change your mind - perhaps C# designers could use a similar source of inspiration.
like @Transactional?
If yes, then I'd really do not want those "magic-like, tricky when it comes to debugging" features