Would you recommend Iron Ruby, Iron Python, or PowerShell for making a C# application a script host?
After some quick tinkering, right now I'm leaning towards powershell for two main reasons (note these a purely my opinions and if they are wrong, I'd love to know!!!):
1) It's simple to create a runspace with classes in your application; therefor it's easy to make your application scriptable.
2) I've heard some rumors that IronRuby and IronPython are losing support from Microsoft, so they may be a poor long term solution?
As this is my first time adding scripting to an application though, I'd welcome all the advice I can get from people who have been down this road before.
Specifically, besides letting me know whether you agree with my two points above, I'd like to know if IronRuby and IronPython are much easier to use (for a user, not developer) than powershell, and if in your experience using the DLR is as easy as just passing an object to a powershell runspace? And if I added support for the DLR and IR/IP scripting would my application still be backwards compatible with XP?
I'm not convinced PowerShell has "being a scripting language for applications" anywhere in it's long-term goals. It's first a shell, second an integration & automation engine, and third a shell scripting language ... since it's not redistributable at all, I'm not sure where embedded scripting fits in.
It's certainly very easy to host PowerShell -- assuming that it's pre-installed on your target PCs-- so it's a very viable option, but I think that in general it's just as easy to do it with IronRuby or IronPython.
I doubt the DLR itself is going away, so I think using a DLR language is still a good choice for this: you'd be set up to accept other DLR languages with much less effort, and the DLR and languages are redistributable.
Also, the work to host PowerShell only gets you PowerShell -- whereas you can leverage the same work to get IronPython and IronRuby working. Who knows, since PowerShell is a dynamic language, maybe it will be ported to the DLR with proper dynamics support in a future version ... but it's unlikely to ever be redistributable, because Microsoft doesn't consider it a dev tool, but rather a core part of the OS.
Bottom line: using the DLR is much more portable -- and not just to XP but even to Mono (and thus to Linux, OS X, iOS, Android, etc... and even to the web or Windows Phone via Silverlight).
number 2 is true (the dynamic lang teams have been losing headcount for awhile now) and an excellent reason. Ruby and Python aren't MS languages, and as such Iron * is just 'get it working on .NET'. PowerShell is a Microsoft creation, Microsoft-controlled, and Microsoft-supported.
More importantly, multiple Microsoft products have taken deep dependencies on PowerShell (Exchange, SharePoint, etc.) so there's very little question of PowerShell's ongoing support as a language.
Last, PowerShell considers being the scripting lang for other applications as one of its first-class support targets.
I'm in a similar position. I decided to use IronPython scripting but ever since I saw Anders Hejlsberg's talk "The Future of C#", I've had a feeling IronPython was doomed.
It was in Microsoft's interest to get the DLR developed but they ultimately want us to use tools and languages they control. After all, aren't you using C# and not Java? So what will a Microsoft dynamic language look like? How about dynamic, interpreted C# (Iron C#)? Hejlsberg's talk made it clear it isn't that far away. He even had a console window with a REPL interface. That said, there's always a possibility for Iron VB. Talk about closing the loop.
On the plus side for us programmers, Iron C# also solves another problem that I'm having trouble with -- the existence of two parallel object environments, one of .Net objects, one of Python objects. It takes work to get from one to the other. I assume an Iron C# would utilize the .Net class structure.
My advice: Stick with Iron Python and .Net classes. When Iron VB or Iron C# happens, it'll be a quick, maybe automatic, language translation. Besides, if enough of us use IronPython, Microsoft may change their mindset.
来源:https://stackoverflow.com/questions/3484232/would-you-recommend-iron-ruby-iron-python-or-powershell-for-making-a-c-sharp-a