diff options
Diffstat (limited to 'doc/faq/faq.xml')
-rw-r--r-- | doc/faq/faq.xml | 197 |
1 files changed, 0 insertions, 197 deletions
diff --git a/doc/faq/faq.xml b/doc/faq/faq.xml deleted file mode 100644 index 193bba12ed..0000000000 --- a/doc/faq/faq.xml +++ /dev/null @@ -1,197 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<?xml-stylesheet type="text/xsl" href="scala-faq.xhtml.xsl"?> -<!DOCTYPE faq PUBLIC "-//lamp.epfl.ch//DTD Scala FAQ//EN" - "scala-faq.dtd"> - -<!-- This file is a collection of frequently asked questions on Scala --> - -<!-- You can link to entries in this document by using id attributes. --> -<!-- Within the document, use the 'seealso' tag for this --> - -<!-- You can validate this file using C-c C-v. in [X]Emacs --> - -<faq> - - <!-- zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz --> - <!-- General --> - <!-- zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz --> - - <section title="General"> - - <entry id="why"> - <question>Why another programming language ?</question> - <answer>Read the rationale available on the <a - href="http://scala.epfl.ch">Scala homepage</a></answer> - </entry> - - <entry> - <question>How can I get an executable program ?</question> - <answer><p><em>First option</em>: use the Application mixin. Example:<code> -class Foo with Application { - ... // the code -} -</code></p> - - <p><em>Second option</em>: use an object that has a main method. E.g. -<code><![CDATA[ -object Foo { - def main(args:Array[String]):Unit = { - ... //the code - } -}]]></code> -Of course you can leave away the specification of the result type. In -that case you should take care that your main function does not return -something else. The latter would result in the virtual machine not finding -your function. -</p> -</answer> - - </entry> - - <entry> - <question>Is Scala stable enough to generate correct code for a - larger scale real life projects? Isn't it dangerous to relay on a - fresh project?</question> - - <answer>You should give it a try. It's quite stable and if you -encounter an issue, you can submit the bug and we try to fix it as -quickly as possible. As a workaround you can always implement the -problematic part in Java.</answer> -</entry> -<entry> -<question> -What's the licensing conditions of the available Scala code? Does the Scala team endorse a specific license? -</question> -<answer> -Currently, Scala is distributed under a BSD-style -license. Consequently, there are almost no implications -when redistributing the Scala binaries. -</answer> -</entry> - -<entry> - <question>Is it possible to package the generated program so that the -user does not have to install the full Scala environment? <p/> -Basically, I just want to give the user a jar -file which can be started by java -jar ... </question> -<answer> -The Scala distribution comes with several jar files -in the lib subdirectory. If you want to package your -Scala application in a way that doesn't require the -user to install the full Scala environment, you simply -have to distribute a copy of the lib/scala.jar file -together with your application. You can even copy the -content of the scala.jar file into your own jar file -if you prefer this. - -</answer> -</entry> </section> - - <section title="Programming"> - <entry> - <question> - What is the "standard" way to write a simple loop in -Scala? -<code> - for (val i <- Iterator.range(1,1000000) -</code> -or -<code> - var i = 1; - while (i<=1000000){ ...; i=i+1; } -</code> -</question> -<answer> -Both are fine, but in the current implementation the second one should be more efficient. </answer> - </entry> - -<entry> -<question>how can I catch exceptions in Scala?</question> - -<answer> You have to use standard pattern matching here (Java's -"catch" clauses are really nothing more than a limited form of pattern -matching). - -<code> - try { - ... - } catch { - case e: Exception => ... - case e:IOException => ... - } -</code> -</answer> -</entry> - - </section> - - - - <!-- zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz --> - <!-- Java InterOp --> - <!-- zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz --> - <section title="Java Interoperability"> - <entry> - - - <question> -I am currently implementing an application in Java. If I go over -to Scala, can I use the existing stuff and link it with the new -Scala code?</question> - -<answer> -Accessing Java classes from Scala code is no problem at all. Using a Scala -class from Java can get tricky, in particular if your Scala class uses -advanced features like generics, polymorphic methods, or abstract types. -Since Java doesn't have such language features, you have to know something -about the encoding scheme of Scala classes. Otherwise, there should be -no problems. -</answer> - </entry> - -<entry> -<question>How easy is it to convert Java data structures to Scala, and vice versa?</question> - -<answer> -You do not have to convert Java data structures at all for using them -in Scala. You can use them "as is". For instance, Scala classes can -subclass Java classes, you can instantiate Java classes in Scala, you -can access methods, fields (even if they are static), etc. -</answer> - -</entry> - </section> - - <!-- zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz --> - <!-- Less General --> - <!-- zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz --> - - <section title="Limitations"> -<entry> -<question>I want to use the Ord interface to handle Double, Int, and Char. Why doesn't it work ?</question> - -<answer>Currently, the class scala.Double (and all other value classes) are -*not* a subclass of scala.Ord. This is an implementation restriction -of our compiler. </answer> -</entry> -<!-- - <entry> - <question>What were the first reactions when you released your language ?</question> - <answer> -<p>"Wow! This is the coolest thing since Haskell and Ruby!"</p> -<p>"Thanks, this is so cool, I can hardly believe it's true"</p> -<p>"I have seen that Scala addresses the right questions. It will be interesting to see whether it also gives the right answers"</p> - -<p>"It seems somebody had the strong desire to do functional programming and still access Java and .NET classes</p> - -</answer> - </entry> ---> - <entry> - <question>Why is feature XYZ not integrated ?</question> - <answer>Convince us that it is useful. Make sure you read - <seealso ref="why"/> before </answer> - </entry> - </section> - -</faq>
\ No newline at end of file |