Code Monkey home page Code Monkey logo

dotty-example-project's Introduction

Example sbt project that compiles using Dotty

Build Status

Usage

This is a normal sbt project, you can compile code with sbt compile and run it with sbt run, sbt console will start a Dotty REPL.

If compiling this example project fails, you probably have a global sbt plugin that does not work with dotty, try to disable all plugins in ~/.sbt/0.13/plugins and ~/.sbt/0.13.

IDE support

Dotty comes built-in with IDE support, to try it out see http://dotty.epfl.ch/docs/usage/ide-support.html

Making a new Dotty project

The fastest way to start a new Dotty project is to use one of the following templates:

Using Dotty in an existing project

You will need to make the following adjustments to your build:

project/plugins.sbt

addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.1.7")

project/build.properties

sbt.version=0.13.15

Older versions of sbt are not supported, sbt 1.0 is not yet supported either.

build.sbt

Any version number that starts with 0. is automatically recognized as Dotty by the sbt-dotty plugin, you don't need to set up anything:

scalaVersion := "0.5.0-RC1"

Nightly builds

If the latest release of Dotty is missing a bugfix or feature you need, you may wish to use a nightly build. Look at the bottom of https://repo1.maven.org/maven2/ch/epfl/lamp/dotty_0.6/ to find the version number for the latest nightly build. Alternatively, you can set scalaVersion := dottyLatestNightlyBuild.get to always use the latest nightly build of dotty.

Getting your project to compile with Dotty

When porting an existing project, it's a good idea to start out with the Scala 2 compatibility mode (note that this mode affects typechecking and thus may prevent some valid Dotty code from compiling) by adding to your build.sbt:

scalacOptions ++= { if (isDotty.value) Seq("-language:Scala2") else Nil }

Using the isDotty setting ensures that this option will only be set when compiling with Dotty.

A tool to port code from Scala 2.x to Dotty is currently in development at https://github.com/scalacenter/scalafix

If your build contains dependencies that have only been published for Scala 2.x, you may be able to get them to work on Dotty by replacing:

    libraryDependencies += "a" %% "b" % "c"

by:

    libraryDependencies += ("a" %% "b" % "c").withDottyCompat()

This will have no effect when compiling with Scala 2.x, but when compiling with Dotty this will change the cross-version to a Scala 2.x one. This works because Dotty is currently retro-compatible with Scala 2.x.

NOTE: Dotty's retro-compatibility with Scala 2.x will be dropped before Dotty is released, you should not rely on it.

Discuss

Feel free to come chat with us on the Dotty gitter!

dotty-example-project's People

Contributors

smarter avatar nicolasstucki avatar felixmulder avatar allanrenucci avatar ferhtaydn avatar darkdimius avatar blaisorblade avatar rsoeldner avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.