1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
<?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>
<!-- 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="Less General">
<!--
<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>
|