{"id":80,"date":"2011-07-29T22:27:33","date_gmt":"2011-07-29T22:27:33","guid":{"rendered":"http:\/\/www.benbarefield.com\/blog\/?p=80"},"modified":"2011-08-02T14:53:24","modified_gmt":"2011-08-02T14:53:24","slug":"answering-a-couple-scala-net-questions","status":"publish","type":"post","link":"https:\/\/www.benbarefield.com\/blog\/2011\/07\/29\/answering-a-couple-scala-net-questions\/","title":{"rendered":"Answering a Couple Scala.Net questions"},"content":{"rendered":"<p><a href=\"http:\/\/twitter.com\/#!\/billwagner\">Bill Wagner<\/a> recently asked me a couple of Scala.Net questions after reading my recent blog posts.<\/p>\n<p><strong>What is the debugging story for Scala.Net?<\/strong><\/p>\n<p>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:<\/p>\n<p>ilasm \/PDB &lt;MSIL file&gt;<\/p>\n<p>After running ilasm, open Visual Studio and create a new Blank Solution (found under Other Project Types \u2013&gt; Visual Studio Solutions.) Then right click the Solution and click Add \u2013&gt; 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 \u2013&gt; Debug \u2013&gt; Start new instance.<\/p>\n<p>Before running the executable, make sure that \u201cenable address level debugging\u201d is set by going to Debug \u2013&gt; Options and Settings.<\/p>\n<p>A break point can be set in any of the Scala files associated with the executable by opening the file in Visual Studio (File \u2013&gt; Open) and setting a break point as if it was any other .Net language file.<\/p>\n<p><strong>If you don\u2019t need a using statement, does that mean that all the Scala code goes into the global namespace?<\/strong><\/p>\n<p>In my <a href=\"http:\/\/www.benbarefield.com\/blog\/?p=76\">Calling Scala from C#<\/a> post, I said:<\/p>\n<blockquote><p>\u2026 [it] surprisingly doesn\u2019t require any extra using statements<\/p><\/blockquote>\n<p>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.<\/p>\n<p>For example, if my Scala code has been:<\/p>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;\">\n<pre id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span style=\"color: #0000ff;\">package<\/span> Speaker<\/pre>\n<pre id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span style=\"color: #0000ff;\">class<\/span> ScalaSpeaker {<\/pre>\n<pre id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\">    def Speak() {<\/pre>\n<pre id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\">        println(<span style=\"color: #006080;\">\"Hello\"<\/span>);<\/pre>\n<pre id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\">    }\r\n    def Speak(name: String) {<\/pre>\n<pre id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\">        println(<span style=\"color: #006080;\">\"Hi, \"<\/span> + name + <span style=\"color: #006080;\">\", glad you could join us!\"<\/span>)<\/pre>\n<pre id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\">    }<\/pre>\n<pre id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\">}<\/pre>\n<\/div>\n<p>Then my C# would need \u201cusing Speaker;\u201d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <a href=\"https:\/\/www.benbarefield.com\/blog\/2011\/07\/29\/answering-a-couple-scala-net-questions\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,28],"tags":[],"class_list":["post-80","post","type-post","status-publish","format-standard","hentry","category-net","category-scala"],"_links":{"self":[{"href":"https:\/\/www.benbarefield.com\/blog\/wp-json\/wp\/v2\/posts\/80","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.benbarefield.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.benbarefield.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.benbarefield.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.benbarefield.com\/blog\/wp-json\/wp\/v2\/comments?post=80"}],"version-history":[{"count":1,"href":"https:\/\/www.benbarefield.com\/blog\/wp-json\/wp\/v2\/posts\/80\/revisions"}],"predecessor-version":[{"id":81,"href":"https:\/\/www.benbarefield.com\/blog\/wp-json\/wp\/v2\/posts\/80\/revisions\/81"}],"wp:attachment":[{"href":"https:\/\/www.benbarefield.com\/blog\/wp-json\/wp\/v2\/media?parent=80"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.benbarefield.com\/blog\/wp-json\/wp\/v2\/categories?post=80"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.benbarefield.com\/blog\/wp-json\/wp\/v2\/tags?post=80"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}