Scala Scripting Scala By the Bay, San Francisco, 12 Nov 2016 Scala - - PowerPoint PPT Presentation

scala scripting
SMART_READER_LITE
LIVE PREVIEW

Scala Scripting Scala By the Bay, San Francisco, 12 Nov 2016 Scala - - PowerPoint PPT Presentation

Scala Scripting Scala By the Bay, San Francisco, 12 Nov 2016 Scala has a code-size gap Scala REPL: lightweight, works great for < 1 line programs, more is problematic Scala has a code-size gap Scala REPL: lightweight, works great for < 1


slide-1
SLIDE 1

Scala Scripting

Scala By the Bay, San Francisco, 12 Nov 2016

slide-2
SLIDE 2

Scala has a code-size gap

Scala REPL: lightweight, works great for < 1 line programs, more is problematic

slide-3
SLIDE 3

Scala has a code-size gap

Scala REPL: lightweight, works great for < 1 line programs, more is problematic

slide-4
SLIDE 4

Scala has a code-size gap

Scala REPL: lightweight, works great for < 1 line programs, more is problematic

slide-5
SLIDE 5

Scala has a code-size gap

Scala REPL: lightweight, works great for < 1 line programs, more is problematic

slide-6
SLIDE 6

Scala has a code-size gap

Scala REPL: lightweight, works great for < 1 line programs, more is problematic

slide-7
SLIDE 7

Scala has a code-size gap

Scala REPL: lightweight, works great for < 1 line programs, more is problematic

slide-8
SLIDE 8

Scala has a code-size gap

SBT: Works great for 1,000 - 100,000 line programs, overkill for small scripts

slide-9
SLIDE 9

Scala has a code-size gap

  • bject Main{

def main(args: Array[String]): Unit = { println("Hello") } }

SBT: Works great for 1,000 - 100,000 line programs, overkill for small scripts

slide-10
SLIDE 10

Scala has a code-size gap

SBT: Works great for 1,000 - 100,000 line programs, overkill for small scripts

slide-11
SLIDE 11

Scala has a code-size gap

SBT: Works great for 1,000 - 100,000 line programs, overkill for small scripts

slide-12
SLIDE 12

Scala has a code-size gap

SBT: Works great for 1,000 - 100,000 line programs, overkill for small scripts

slide-13
SLIDE 13

Scala has a code-size gap

SBT: Works great for 1,000 - 100,000 line programs, overkill for small scripts

slide-14
SLIDE 14

Scala has a code-size gap

Scala REPL: lightweight, works great for < 1 line programs, more is problematic SBT: Works great for 1,000 - 100,000 line programs, overkill for small scripts

slide-15
SLIDE 15

Scala has a code-size gap

Scala REPL: lightweight, works great for < 1 line programs, more is problematic SBT: Works great for 1,000 - 100,000 line programs, overkill for small scripts

?

slide-16
SLIDE 16

Scala has a code-size gap

Scala REPL: lightweight, works great for < 1 line programs, more is problematic SBT: Works great for 1,000 - 100,000 line programs, overkill for small scripts

Ammonite Scala REPL/Scripts

slide-17
SLIDE 17

Ammonite: Scala Scripting lihaoyi.github.io/Ammonite

slide-18
SLIDE 18

Ammonite-REPL

Like the Scala REPL,

slide-19
SLIDE 19

Ammonite-REPL

Like the Scala REPL, but better

slide-20
SLIDE 20

Ammonite-Scripts

Write Scala without the fuss

slide-21
SLIDE 21

Demo: Ammonite REPL

slide-22
SLIDE 22

Scala has a code-size gap

Scala REPL: lightweight, works great for < 1 line programs, more is problematic Ammonite REPL: lightweight, works great for 1 - 10 line programs SBT: Works great for 1,000 - 100,000 line programs, overkill for small scripts

slide-23
SLIDE 23

Scala has a code-size gap

Scala REPL: lightweight, works great for < 1 line programs, more is problematic Ammonite REPL: lightweight, works great for 1 - 10 line programs Ammonite Scripts: works for 10 - 1,000 line programs SBT: Works great for 1,000 - 100,000 line programs, overkill for small scripts

slide-24
SLIDE 24

Demo: Ammonite Scripts

slide-25
SLIDE 25

Like running scripts with the `scala` command but...

Can you use third party libraries?

slide-26
SLIDE 26

Like running scripts with the `scala` command but...

Can you use third party libraries?

  • Can you import other scripts?
slide-27
SLIDE 27

Like running scripts with the `scala` command but...

Can you use third party libraries?

  • Download jar yourself, download transitive dependencies, use `-cp`, ...

Can you import other scripts?

  • No
slide-28
SLIDE 28

Like running scripts with the `scala` command but...

Can you use third party libraries?

  • import $ivy.`com.lihaoyi::scalatags:0.6.2`

Can you import other scripts?

  • import $file.foo
  • import $file.foo.bar
slide-29
SLIDE 29

Like running scripts with the `scala` command but...

Can you use third party libraries?

  • import $ivy.`com.lihaoyi::scalatags:0.6.2`
  • libraryDependencies += "com.lihaoyi" %% "scalatags" % "0.6.2"

Can you import other scripts?

  • import $file.foo
  • import $file.foo.bar
slide-30
SLIDE 30

Like running scripts with the `scala` command but...

Can you use third party libraries?

  • import $ivy.`com.lihaoyi::scalatags:0.6.2`
  • libraryDependencies += "com.lihaoyi" %% "scalatags" % "0.6.2"

Can you import other scripts?

  • import $file.foo // loads foo.sc
  • import $file.foo.bar // loads foo/bar.sc
slide-31
SLIDE 31

Demo: Ammonite Script Imports

slide-32
SLIDE 32

Demo: Ammonite Website

slide-33
SLIDE 33

Scala has a code-size gap

Scala REPL: lightweight, works great for < 1 line programs, more is problematic Ammonite REPL: lightweight, works great for 1 - 10 line programs Ammonite Scripts: works for 10 - 1,000 line programs SBT: Works great for 1,000 - 100,000 line programs, overkill for small scripts

slide-34
SLIDE 34

Use Cases

www.lihaoyi.com www.lihaoyi.com/Resume github.com/lihaoyi/Ammonite/blob/master/ci/build.sc

slide-35
SLIDE 35

Next Steps

slide-36
SLIDE 36

Next Steps: need more usage

  • Currently about 6-7k downloads a month
  • More users = more edge cases get found, more help fixing bugs,
  • More users = more info to help set direction of development
slide-37
SLIDE 37

Next Steps: need more contributors!

  • Lots of people contributing fixes, but still mostly me driving development
  • Script-runner was mostly built by two GSOC interns, but they've moved on
  • Need more people to sustainably drive project forward
slide-38
SLIDE 38

Next Steps: concrete tasks

  • IntelliJ support for scripts
  • Convert autocomplete to use 2.12 REPL's improved autocomplete
  • Experiment with using shapeless for more stable pretty-printing
  • Better SBT integration: re-use compiler settings? Plugins?
  • Spark support??
slide-39
SLIDE 39

Scala has a code-size gap

Scala REPL: lightweight, works great for < 1 line programs, more is problematic SBT: Works great for 1,000 - 100,000 line programs, overkill for small scripts

?

slide-40
SLIDE 40

Scala has a code-size gap

Scala REPL: lightweight, works great for < 1 line programs, more is problematic Ammonite REPL: lightweight, works great for 1 - 10 line programs Ammonite Scripts: works for 10 - 1,000 line programs SBT: Works great for 1,000 - 100,000 line programs, overkill for small scripts

slide-41
SLIDE 41

Scala Scripting

Scala By the Bay, San Francisco, 12 Nov 2016

slide-42
SLIDE 42

Q & A