So you've got to create your own scripting language built in .NET C#. What's better now for libraries? (think SDL/OPENGL), generate wrappers with Swig or do it by hand? Any other choice?
A:
I would recommend using the CLR.
This way, you get the entire FCL, and any third-party libraries that people write in .Net, without having to do any additional work.
SLaks
2009-09-27 02:16:40
The problem is my language is much different to map it's types to CLR types: closures, recursive types, arbitrary numbers and such. There are no stringbuilders for example but a unicode.string class.I don't really want to integrate it with the .NET Runtime and fight to shoehorn everything it needs but i find beeing able to use SDL/OpenGL attractive.
thatotherguy
2009-09-27 02:25:55
I would say that it's worth the effort. You can write your own set of types for the language, and have the compiler automatically convert them into .Net native types when you pass them to an external function. The
SLaks
2009-09-27 02:28:51
+1
A:
Since you're building the language in C#/.NET (which I will comment about later), you should have easy access to the entire .NET library system. This should make it very easy to use existing libraries to make .NET assemblies, and have them exposed to your scripts.
However, I'd question wanting to make a scripting language in C# - There are very good options out there, especially if you take the DLR (dynamic language runtime) into account. You can provide scripting to an existing C# application very easily without making a custom language.
Reed Copsey
2009-09-27 02:19:50
Hi.I'm not using the DLR. (i like it but it doesn't support tail recursion and some other features i need like first class environments easily)."This should make it very easy to use existing libraries to make .NET assemblies, and have them exposed to your scripts."Yes, that would be the route if i did it by hand. Generate an assembly, then do a wrapper.
thatotherguy
2009-09-27 02:44:19