开发者

What scripting language for our .NET based IDE? [closed]

Closed. This question is opinion-based. It is not开发者_如何学Python currently accepting answers.

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 8 years ago.

Improve this question

We have an IDE for machine automation that allows its users to develop solutions by connecting objects and components visually. They can also write "plugins" using C++ and C#. The IDE is written using .NET. Its users often are not founded in traditional software development and programming but more in the direction of technical/electrical and automation engineers but they all need to know the basics of C# and C++ programming.

If we were to introduce a macro/scripting language for the IDE itself including an interactive console (designtime only) which language should we chose? It should be a dynamic scripting language that both has a good foundation in .NET and the DLR in that it is future proof and has good support and a decent momentum behind it but also would not have such a steep learning curve for our special developers. Ideally it should be completely intuitive to use if you know C++ and/or C# - even if you are not a rock-solid software developer.

UPDATE: The option that currently is most attractive to us, is to use dynamically compiled C#. Our users could continue to use C#. It even seems to be possible to build an interactive console, as CSI proves. What do you think of this option? Are there any potential pitfalls/downsides that we (due to our lack of experience with scripting in general) just are not aware of yet?


Python (IronPython) would have my vote. It is a dynamic language that you can use for scripting .NET programs, and you can use it interactively (haven't actually tried interactive with IronPython, but you certainly can with "regular" python). Unfortunately, it's not going to be completely intuitive to your C++ and C# devs.

You could just use C# as your scripting language (you can compile and execute the code at runtime), but you wouldn't get an interactive console, and it's not very "script"-like.

I think simplicity is very important in a scripting language. "Hello World" in Python is simply print "Hello World", where in C# you would need a namespace, class, static Main method, etc. If you want to use C#, you can simulate that by wrapping the user-supplied code inside of a function definition (or at least a class) before compiling, so their "script" can simply be the function's contents. That will somewhat restrict what they can do in a script, which could be good or bad, depending on what you want. If they need multiple classes and functions, maybe they would need to write a full plugin in your case.


I think we will either roll our own c# based scripting environment, sort of like a much simplified version of the very cool CS-Script or we would integrate CS-Script right away.


I embedded a little C# editor in an app and compiled/ran results

ala

var codeProvider = new CSharpCodeProvider( 
              new Dictionary<string, string> { { "CompilerVersion", "v3.5" } } );

var parameters = new CompilerParameters( );
// add any of your 'library' dlls as references
parameters.ReferencedAssemblies.AddRange( dlls.ToArray( ) );
parameters.OutputAssembly = outputPath;
CompilerResults r = codeProvider.CompileAssemblyFromFile( parameters, sourceFiles );


The future isn't clear for the DLR the currently-supported dynamic languages IronRuby and IronPython. What's unclear is Microsoft's direction on those 2. Until I hear it from The Gu or higher, I'd avoid making a decision on either one of those 2. That doesn't help you today, making a design decision for your users. I get the sense that IronPython will retain support, but that's just baseless speculation.

For .NET scripting, also consider Boo.

Boo is an object oriented, statically typed programming language that seeks to make use of the Common Language Infrastructure's support for Unicode, internationalization and web applications, while using a Python-inspired syntax1 and a special focus on language and compiler extensibility. Some features of note include type inference, generators, multimethods, optional duck typing, macros, true closures, currying, and first-class functions.

  • Official Boo Site
  • Wikipedia entry for Boo


If you look at the way Microsoft is heading with scripting / automation of their products PowerShell would the thing to target.

Developing your custom host and provider should integrate nicely into your .NET application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜