So today I was reading up on a development community website, and I ran across one of the classic arguments that will ultimately erupt when two or more Windows developers get together: which is the better language, VB, C# or Managed C++. These arguments always make me chuckle a bit, because with the .NET Framework it does not make much of a difference which language you choose since it all gets compiled down to IL


That discussion did remind me of an idea I had at one time, and if any of you adventurous developers feel like stealing the idea and implementing it yourself, then by all means steal away. Why do you need to select one language over another, why can’t you use all of them? I can create a HTML file, and use different languages within that page. For example, I could use JScript and VB Script at the same time, as so:




            <script language="jscript">



            <script language="vbscript">

                  msgbox "Hello"





Why can’t I do the same with VB.NET, C#, or managed C++? For instance, why can’t I start Visual Studio, create a blank project, and enter code such as this:


<code language="VBNet">

Public Class Class1

      Sub Function1()

            System.Windows.Forms.MessageBox.Show("Hello from VB")

      End Sub

End Class


<code language="CSharp">

public class Class2


      static string s = “abc”;

      public void Function2()


            System.Windows.Forms.MessageBox.Show("Hello from C#");




<code language="MCPP">

public __gc class Class3



      void Function3()


            System::Windows::Forms::MessageBox::Show(S"Hello from managed C++");






There are ways of doing something like this with current technology. I could create three separate projects, add project to project references, and call across the different assemblies. But then I need to build three separate projects, create, package, and install three separate DLLs. I could also create net modules, but then again, you would have three separate DLLs.


This new model has some other benefits. How many times have you found a sample function that would work perfectly for your code? If you selected one language (suppose C++) but the sample code is in another language (for example VB .NET), then you need to translate the code into the other language. That is not too tough if the code is small, but if it is a few hundred, or even a few thousand lines, you would spend more time translating than writing it from scratch (and even cause a number of bugs while doing it).  Not only does it enable better code sharing, but it also allows better team development. It will allow all the developers in your group to put all their code in one project, and use whatever language they want to use without the code being scattered about.


This has not been completely thought through though (say that three times fast). For example, how does Function3 access the static variable s declared within Class2? Cross-language data access is not allowed in the HTML version, either, so this is not something new. The compilers today are type safe, and if the compiler cannot find the type of variable s, then how can it compile? And why should each function be declared in separate classes? Why can’t you declare a class, and have Function1, Function2, and Function3 within the same class, but use different languages? I didn’t say it would be easy, or even work with the current technology, only that I think it would be an easier way of developing.