Answering a Couple Scala.Net questions

Bill Wagner recently asked me a couple of Scala.Net questions after reading my recent blog posts.

What is the debugging story for Scala.Net?

A pdb file is required for debugging in Visual Studio, just like with C#. The pdb file contains all of the debugging symbols that Visual Studio uses to track the run of the program. A pdb file can be generated when running ilasm:

ilasm /PDB <MSIL file>

After running ilasm, open Visual Studio and create a new Blank Solution (found under Other Project Types –> Visual Studio Solutions.) Then right click the Solution and click Add –> Existing Project. Change the filter to show executable files and add the executable generated by ilasm. Now the executable can be run through Visual Studio in various ways; for example, right click the executable –> Debug –> Start new instance.

Before running the executable, make sure that “enable address level debugging” is set by going to Debug –> Options and Settings.

A break point can be set in any of the Scala files associated with the executable by opening the file in Visual Studio (File –> Open) and setting a break point as if it was any other .Net language file.

If you don’t need a using statement, does that mean that all the Scala code goes into the global namespace?

In my Calling Scala from C# post, I said:

… [it] surprisingly doesn’t require any extra using statements

The reason a using statement was not required was because I did not put the Scala code I wrote into a package. If I had, a using statement would have been needed for the package.

For example, if my Scala code has been:

package Speaker
class ScalaSpeaker {
    def Speak() {
        println("Hello");
    }
    def Speak(name: String) {
        println("Hi, " + name + ", glad you could join us!")
    }
}

Then my C# would need “using Speaker;”

This entry was posted in .Net, Scala. Bookmark the permalink.