Csaba wrote:I have a wish concerning variable scope It would be nice if a variable declared in the try scope is also available in the catch scope but maybe it is so? It is a fundamental design flawn in VB. But they can’t change it now since too muck code would break
Cobra is like Python and unlike C# in that variables are not scoped to their block. So yes, you can do this.
My experience with going back and forth between Python and C# is that implementing methods is much faster and less distracting in Python. However, I then miss C#'s run-time performance, and the use of declarations and typing can speed up refactoring (due to the compiler finding errors as you reorganize the code). Consequently, Cobra is more like C# at a high level and more like Python inside a method.
Csaba wrote:Further, The possibility to easily catch errors and find where it realy occired it would be nice if some reflection information were more easily available in Cobra compared with VB. If I had these small examples available when I learned to program VB and .NET, I would have saved a lot of time. Very much time
Whether in VB or Cobra, can't you just use "exc.stackTrace" to get that? See
MSDN System.Exception.StackTraceAlso, try "cobra -d myprog.cobra" to get debugging info as in the filename and line numbers to make that stack trace more useful.
Also, if you can handle a 5-10MB HTML generated report, try "cobra -er -dst myprog.cobra" on a program that is throwing an exception. The -er gives the exception report and the -dst further enhances it to include a "detailed stack trace" which means you get the values of all arguments and locals on every stack frame. Sometimes I really need that info when I'm working on the compiler itself.
You'll note that when you click an object in the report you will jump down in the report to a table for that object with all its properties and their values. Those values may be objects as well which you can click on. Then you can use your browser's Back button to back up.
HTH