As I started working on a little pet project for my friend NiKo, before clicking on the Visual C# icon (as I usually do) I actually started thinking about using languages other than C#. As blasphemous as it might sound, I really liked the idea of getting something to work using a "new" language, even if I had to study it and glance over the documentation the whole time (besides, you should learn a new language every year).
But still, I absolutely wanted the program to run on .NET because I'm really used to the base class library and to Windows Forms in particular: therefore, IronPython, IronRuby and similar languages came to my mind. Brooding about that on the train back to Foligno, I was almost sold on using Python, since I have been reading a lot about it and never had the chance to use it. But then, I discovered another "reptile" programming language for .NET: the Cobra language. 
Cobra has a similar syntax to Python but seems to better adapt to .NET (properties and such) and drops all the - in my opinion - extremely ugly conventions of Python (like the double underscores, all the self declarations in member functions, and so on).
Starting using Cobra
All you need to start programming with Cobra is in the small package you find on the website: the Cobra compiler essentially converts all cobra code to C# files (referencing its runtime Cobra.Lang.dll if needed) and then compiles to an executable using the standard C# compiler.
I also didn't use any IDE for my work with Cobra: just Notepad++ (Python syntax highlighting works quite well) and a hand made batch file to compile all files. This rudimental programming style was especially painful in the beginning: I noticed I can't even remember the namespaces of all classes I use...
But anyway, at the end of the day you gain some speed and I also noticed that I seemed to be more focused without IDE (might as well be a completely wrong impression since I was still struggling with the language).
Writing a Windows Forms project
The project I mentioned is mainly focused on the GUI and working with Windows Forms on Python, without a visual designer can be pretty boring and painful. Anyway, it works and it actually forces you to realize how hard it is to design a decent looking GUI directly in code.
Anyway, I was almost stuck with two big problems. I will explain them here, hoping that someone will find the solutions I found useful someday... 
Nested class references
The Cobra compiler (version 0.8) has some problems in referencing nested classes sometimes. I had the exact problem as also seen on the Cobra forums, where the compiler would spit out this
error: Cannot locate nested CLR type "System.Windows.Forms.Layout.LayoutUtils+MeasureTextCache" (simple name is "MeasureTextCache").
Compilation failed - 1 error, 0 warnings
as soon as I referenced the "Label" class in my code (and working without labels can be quite difficult
).
There is no working solution, but only an ugly workaround hack: first of all, download the Cobra source from the repository:
svn co http://cobra-language.com/svn/cobra/trunk/ cobra-workspace
You'll discover that the Cobra compiler itself is written in Cobra. Open up the file /Source/TypeProxies.cobra and go to line 182 or so. You'll find this:
if potential is nil
# comes up on MS Windows .NET 2.0 for multiple types when using System.Windows.Forms
# error: Cannot locate nested CLR type "System.Windows.Forms.UnsafeNativeMethods+IOleControl" (simple name is "IOleControl").
if 'NativeMethods' in clrType.toString
return _hack(clrType)
.throwError('Cannot locate nested CLR type "[clrType]" (simple name is "[clrType.name]").')
else if potential inherits IType
return potential
else
.throwError('Located CLR type spec "[clrType]" but got a [potential.englishName] instead of a type.')
As you can see, the bug is known but not fixed. Replace the code with something like this:
if potential is nil
# comes up on MS Windows .NET 2.0 for multiple types when using System.Windows.Forms
# error: Cannot locate nested CLR type "System.Windows.Forms.UnsafeNativeMethods+IOleControl" (simple name is "IOleControl").
if 'NativeMethods' in clrType.toString
return _hack(clrType)
#.throwError('Cannot locate nested CLR type "[clrType]" (simple name is "[clrType.name]").')
return _hack(clrType)
else if potential inherits IType
return potential
else
.throwError('Located CLR type spec "[clrType]" but got a [potential.englishName] instead of a type.')
I know this is ugly and could probably bite you somewhere in other code, but it worked for me.
Recompile cobra (launching comp.bat) and replace the generated cobra.exe with your current compiler from the 0.8 version.
OpenFileDialog blocking
Another mysterious problem was caused by a simple call to OpenFileDialog.ShowDialog() which was blocking the whole application thread without showing any dialog. I investigated for hours to find the reason for this very weird behavioud and finally found out it was all my fault for forgetting something very basic... 
Therefore: always ensure that your Windows Forms application has the STAThread attribute set! It's easy to forget it because Visual Studio always generates those bits of code for you...
use System.Windows.Forms
class MyApplication
def main
is shared
has STAThread
Application.enableVisualStyles
Application.setCompatibleTextRenderingDefault(false)
Application.run(MainForm())