Hacker News new | past | comments | ask | show | jobs | submit login

But you can’t go very far without serialization libraries these days. Would CoreRT be able to deal with that?



The new compile time code generation feature should largely eliminate the need for using runtime reflection, at least for serialization.


> so the JIT is going to be more of a legacy burden

I use Reflection, Reflection.Emit, and Linq.Expressions not just for serialization.

Building code in runtime from something else can be a win, especially performance but sometimes development time as well. That "something else" is not necessarily other code: https://github.com/Const-me/Vrmac/blob/master/Vrmac/Draw/Tex...


You can replace code generation used for serialization with open delegates, and that should work without any special runtime magic:

https://github.com/naasking/HigherLogics.Google.Datastore/bl...

Constructors are the only odd duck for which there is no efficient alternative. You either generate a delegate at runtime to call the right constructor, or you have to use reflection/Activate.CreateInstance.


What's the reason you can't use AoT compilation together with serialization? The only thing that's problematic is reflection, but I wouldn't use reflection in my serialization if I can help it.


But I believe that’s what .net serialisers currently use.


Absolutely. But I apart from a very few trivial cases I wouldn’t recommend anyone to use any of the BLC serializers.


I am not going to enter into a debate about the merits of various serializers, but if netwonsoft.json doesn’t run, that’s half of the nuget packages that cannot run in that app. That pretty much guaranties its failure in term of adoption.


Yeah I didn’t even consider text based serialization (json, xml). I know there is at least a couple of aot-aware json.net ports but obviously those aren’t going to be what existing packages use. It seems like a pretty small hurdle though. Once AoT is commonplace more packages will support it, including json.net. It might take three years or ten, but it will happen (I consider 5 years to be a blink of an eye in this space...)


If it works anything like Mono AOT (used in Xamarin.iOS and Xamarin.Android) you can probably annotate parts of your code to be preserved.

A couple of days ago I found this though, it works using source generators and so it doesn't require reflection to work: https://github.com/TomaszRewak/C-sharp-stack-only-json-parse...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: