Also talk about using the Scala language on the. NET Platform (top)

Source: Internet
Author: User
Tags dot net dotnet mscorlib

A few days ago, Lao Zhao published two articles: in. NET platform using the Scala language (top): first taste and use Scala language on the. NET platform (bottom): Analytics.

After I read it, I was interested in the Scala language. So I started trying.

Installing the Scala SDK on the Ubuntu 9.10 operating system is a very simple thing:

[email  protected]:~$  sudo apt-get install scala   [email protected]:~$  scalac-version  Scala compiler version 2.7.5final --(c) 2002-2008 lamp/epfl[email protected]:~$  scala-version  Scala Code runner version 2.7.5final --(c) 2002-2008 lamp/epfl[email protected]:~$  Scala  Welcome to Scala version 2.7.5final  (OpenJDK 64-bit Server VM, Java 1.6.0_0). Type in expressions to has them evaluated. Type:help for more information.scala> : Quit  [email protected]:~$ 

As you can see, the installed version is 2.7.5, not far from the latest version of 2.7.7. UBUNTN will periodically update the software it provides. It is believed that the Scala packages in the Ubuntu system will be upgraded to the newer version in the near future.

As you can see, Ubuntu also offers some scalable packages on linear algebra (Linear Algebra).

The Scala package provided by Ubuntu does not include the Sbaz tool. This is because Ubuntu uses its own APT tool for package management, so other package management tools are disabled. For example, the "Check for updates" menu items such as Firefox are disabled or canceled in the Ubuntu system.

The Scala library files in the Ubuntu system are placed in the/usr/share/java directory, as shown in:

The Scala compiler and interpreter are placed in the/usr/bin directory, as shown in:

As you can see, in the Ubuntu operating system, the various files of Scala software are scattered throughout the operating system, rather than in a directory like/opt/scala-2.7. This is the Debian type of Linux design philosophy. This philosophy of design and the various software packages of the respective centralized design philosophy have strengths and weaknesses, if you want to open a discussion, but also a mouth water fights. :)

Of course, in the Ubuntu operating system can also not use the Apt-get command, but to the official Scala website to download the latest Scala 2.7.7 Linux installation package, installed on their own, so it will be centrally installed together, but also can have sbaz tools. Of course, this is the time for you to be responsible for the upgrade of the Scala software package, the Ubuntu operating system will not help you upgrade the update without using the Apt-get command to install the package.

Since there is no sbaz tool, we need to find the three files of mscorlib.dll, Predef.dll and Scalaruntime.dll, and then put them in the/usr/local/lib/scala-net directory, as follows:

sudo mkdir/usr/local/lib/scala-net sudo mv mscorlib.dll predef.dll scalaruntime.dll/usr/local/lib/scala-net

Then write a scalac-net file like the one shown below into the/usr/local/bin directory:

In this way, Scala's. NET environment is ready and you can start working.

First, edit the Dotnet.scala source program as shown:

Then, follow these steps to compile and run the program:

[email protected]:~/work/scala$  scalac-net Dotnet.scala  [email  protected]:~/work/scala$  ilasm dotnet.msil  assembling ' Dotnet.msil ', no listing file, to exe--' Dot Net.exe ' operation completed successfully[email protected]:~/work/scala$  Mono Dotnet.exe         scala.net: Welcome to       OS Version:unix 2.6.31.16      CLR Version:2.0.50727.1433default encoding:system.text.utf8encoding[email protected]:~/ work/scala$ 

Note that before running Dotnet.exe, the/usr/local/lib/scala-net/predef.dll file must be copied to the current directory.

As you can see, the CLR version of Scala.net is already 2.0.50727.1433.

Let's see what mscorlib.dll files are on this machine:

[email protected]:~$  ls-l/opt/mono-2.6/lib/mono/*/mscorlib.dll/usr/lib/mono/ */mscorlib.dll/usr/local/lib/scala-net/mscorlib.dll -rwxr-xr-x 1 root root 2092544 2009-12-18 10:01/opt/ Mono-2.6/lib/mono/1.0/mscorlib.dll-rwxr-xr-x 1 root root 2586624 2009-12-18 10:02/opt/mono-2.6/lib/mono/2.0/ mscorlib.dll-rw-r--r--1 root root 2076672 2009-09-23 23:28/usr/lib/mono/1.0/mscorlib.dll-rw-r--r--1 root root 2565632 2 009-09-23 23:29/usr/lib/mono/2.0/mscorlib.dll-rw-r--r--1 ben  ben  2070528 2009-12-22 10:35/usr/local/lib/ scala-net/mscorlib.dll[email protected]:~$ 

In the/opt/mono-2.6/lib/mono directory is the Mono 2.6.1 version, see: Installing Mono 2.6 in the Ubuntu 9.10 operating system.

In the/usr/lib/mono directory is the Ubuntu 9.10 operating system comes with mono 2.4.2.3 Version.

In the/usr/local/lib/scala-net directory is the scala.net.

These five mscorlib.dll files vary in size and appear to be of different versions.

As for the version of these mscorlib.dll files, and the further topic of scala.net, leave the next article to continue.

Copyright NOTICE: This article for Bo Master http://www.zuiniusn.com original article, without Bo Master permission not reproduced.

Also talk about using the Scala language on the. NET Platform (top)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.