In many enterprise platforms that offer developers capability to integrate code by uploading plugins via assemblies, etc its common to see them wrap the plug-in up dynamically like this and then compile it for performance....but Roslyn for C# has made it much easier and more elegant.
In my own experience we needed a dynamic rules engine that could be used with C# syntax where Roslyn compiled expressions from strings was awesome.
In other languages like XSLT where you can extend it with powerful C# functions right there in the source of the XSLT they are using capabilities such as dynamic compilation to enable this....
Sure it’s rare for the average developer to need this at all, and should really question it if they think they do....but there are some very valid use cases for having this capability, so much so that Roslyn was developed ;-) ...
And as someone else mentioned Microsoft is now moving into source generators which will be powerful tools that many underlying frameworks will take advantage of.
Yeah with Roslyn it was really a breeze (comparatively speaking as dynamic rules engines go)...here’s an article that helps juxtapose the two approaches
60
u/NotSteve_ evil Jan 14 '21
Haha seriously? What possible use could writing functions in strings have