-
I like the look of this, and I've been eyeing up the prominent polyfills in the C# space at the moment, the main ones I'm aware being:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @slang25. All of these libraries more or less do the same thing, but have slightly different design philosophies. PolySharp was the first of the three libraries. It uses a source generator to provide polyfills, which in theory could be really powerful (i.e., trimming out polyfills that are not referenced by user code), but I'm not sure if Sergio did anything elaborate with that. It also originally started as polyfill library only for compiler plumbing code (mostly various attributes, Then came Polyfill by Simon which was basically PolySharp with that suggestion being incorporated in the design. I think Simon experienced the same struggles as me, having to bridge gaps between various APIs in a bunch of projects, so he decided to build a library to do that. He chose against using the source generator approach and instead opted for a source-only package with code files that are imported during build. His library was the closest thing to what I needed, but I wanted to support really old .NET Framework versions (I have some .NET 3.5 projects for reasons) and he only plans to support .NET 4.6.1 and up. Finally, I made PolyShim. It's more or less the same as Polyfill. The key differences are the following intentions:
Overall, even if you disregard the feature sets, at the end of the day all these libraries also differ in what kind of APIs they cover. It's pretty much impossible to provide a complete polyfill package, so I'm mainly focusing on things that I actually use in my projects and add new polyfills one at a time. Hope that helps! |
Beta Was this translation helpful? Give feedback.
Hi @slang25.
All of these libraries more or less do the same thing, but have slightly different design philosophies.
PolySharp was the first of the three libraries. It uses a source generator to provide polyfills, which in theory could be really powerful (i.e., trimming out polyfills that are not referenced by user code), but I'm not sure if Sergio did anything elaborate with that. It also originally started as polyfill library only for compiler plumbing code (mostly various attributes,
IsExternalInit
, and other stuff). I created a suggestion to expand that to also polyfill instance methods, but I think Sergio wasn't really found of the idea.Then came Polyfill by Simon which was basicall…