Skip to content

Commit

Permalink
Merge pull request #3328 from dotty-staging/doc-getting-started
Browse files Browse the repository at this point in the history
Rewrite "Getting Started: Users" page
  • Loading branch information
allanrenucci authored Oct 16, 2017
2 parents d04a8c9 + b9b92e2 commit 10f5c3f
Showing 1 changed file with 41 additions and 61 deletions.
102 changes: 41 additions & 61 deletions docs/docs/usage/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,94 +5,74 @@ title: Getting Started: Users



Basics
------------
Make sure that you are using Java 8 or later. The output of `java -version`
should contain `1.8`.
## Trying out Dotty

### In your web browser
[Scastie](https://scastie.scala-lang.org/?target=dotty), the online Scala playground, supports Dotty.
This is an easy way to try Dotty without installing anything, directly in your browser.

Option 1: Install Dotty
-------------
If you're a Mac user, you can install dotty with [brew](https://brew.sh/)
### sbt
The fastest way to create a new project compiled by Dotty is using [sbt (0.13.13+)](http://www.scala-sbt.org/)

Create a simple Dotty project:
```bash
brew install lampepfl/brew/dotty
$ sbt new lampepfl/dotty.g8
```

If you're a Linux or Windows user, download the [latest release](https://github.com/lampepfl/dotty/releases). Optionally add path of the folder `bin/` to the system environment variable `PATH`.

Option 2: Using Dotty directly from source
-------------
Or a Dotty project that cross compiles with Scala 2:
```bash
$ git clone --recursive https://github.com/lampepfl/dotty.git
$ cd dotty
$ sbt managedSources # Needed for IDE import to succeed
$ sbt new lampepfl/dotty-cross.g8
```

Dotty provides a standard sbt build: compiling, running and starting a repl can
all be done from within sbt:

You can then start a Dotty REPL directly from your sbt project:
```bash
$ sbt
> dotc tests/pos/HelloWorld.scala
> dotr HelloWorld
hello world
> console
scala>
```

Try Dotty
----------
Try it in your browser with [Scastie](https://scastie.scala-lang.org/?target=dotty)
For more information, see the [Dotty Example Project](https://github.com/lampepfl/dotty-example-project)

### IDE support
Start using the Dotty IDE in any Dotty project by following the
[IDE guide](http://dotty.epfl.ch/docs/usage/ide-support.html).

Create a Dotty Project
-----------------------
The fastest way to create a new project in dotty is using [sbt (0.13.5+)](http://www.scala-sbt.org/)
### Standalone installation
Releases are available for download on the [Releases section](https://github.com/lampepfl/dotty/releases))
of the Dotty repository. Releases include three executables: `dotc` the Dotty compiler,
`dotd` the [Dotty Documentation tool](http://dotty.epfl.ch/docs/usage/dottydoc.html) and `dotr` the Dotty REPL.

Create a dotty project:
```bash
$ sbt new lampepfl/dotty.g8
```

Or a Dotty project that cross compiles with Scala 2:
```bash
$ sbt new lampepfl/dotty-cross.g8
.
└── bin
   ├── dotc
   ├── dotd
   └── dotr
```

For an example project, see the [Dotty Example Proejct](https://github.com/lampepfl/dotty-example-project)


Bash Scripts
-------------
Assuming that you have cloned the Dotty repo locally, append the following line on your `.bash_profile`:

```shell
$ export PATH=$HOME/dotty/bin:$PATH
```

and you will be able to run the corresponding commands directly from your console:

```shell
Add these executables to your `PATH` and you will be able to run the corresponding commands directly
from your console:
```bash
# Compile code using Dotty
$ dotc tests/pos/HelloWorld.scala
$ dotc HelloWorld.scala

# Run it with the proper classpath
$ dotr HelloWorld

# Start a Dotty REPL
$ dotr
Starting dotty REPL...
scala>
```

If you're a Mac user, we also provide a [homebrew](https://brew.sh/) package that can be installed by running:

Starting a REPL
----------------
```bash
$ sbt
> repl
Welcome to Scala.next (pre-alpha) (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_101).
Type in expressions to have them evaluated.
Type :help for more information.
scala>
```
brew install lampepfl/brew/dotty
```

or via bash:
In case you have already installed Dotty via brew, you should instead update it:

```bash
$ dotr
```
brew upgrade dotty
```

0 comments on commit 10f5c3f

Please sign in to comment.