Upgrade to Pro — share decks privately, control downloads, hide ads and more …

What's scala.js?

cupper
November 16, 2019

What's scala.js?

cupper

November 16, 2019
Tweet

More Decks by cupper

Other Decks in Programming

Transcript

  1. Who am I • Name : Kazuhisa Kawashima • Home

    : Shizuoka shi, aoi ku • Company : YUMEMI inc. • Job : Computer Engineer • Favorite computer language : Scala, TypeScript
  2. What is Yumemi? Company Features • We are a software

    engineering company. • We value the growth of everyone. • All employees are CEOs. • The salary is decided by yourself. • We decide all things by the proposal request. Reference : https://note.mu/raykataoka/n/n50c282bcb305
  3. Scala.js is ... • One of the AltJS • Create

    JavaScript from code written in Scala Scala JavaScript AltJS Scala.js TypeScript Kotlin.js CoffeeScript translate
  4. Classes class Person { constructor(public firstName: string, public lastName: string)

    { } fullName() { return `${this.firstName} ${this.lastName}`; } } class Person(val firstName: String, val lastName: String) { def fullName(): String = s”${firstName} ${lastName}” } Scala.js TypeScript
  5. Collections const personMap = new Map<number, Person>([ [10, new Person(“Roger”,

    ”Moore”)], [20, new Person(“James”, “Bond”)] ]); const names = new Array<string>(); for (const [key, person] of personMap) { if (key > 15) { names.push(`${key} = ${person.firstName}`); } } val personMap = Map( 10 -> Person(“Roger”, ”Moore”), 20 -> Person(“James”, “Bond”) ) val names = for { (key, person) <- personMap if key > 15 } yield s”$key = ${person.firstName}” Scala.js TypeScript
  6. On the web browser Web browser Scala.js Storage Rest Client

    Framework(for instance, Vue.js) JavaScript / TypeScript View
  7. Scala is • Fusion of OOP and FP • Statically

    typed • Interaction with Java language • It takes longer to learn than other languages
  8. Fusion of OOP and FP Object oriented language Procedures Data

    Functional language Side effects exclude fusion State exclude
  9. Statically typed If you use Scala ... • The compiler

    check simple mistake before running. ◦ Missing a type ◦ Typo ◦ Missing number of arguments • You’ll be able to use the IDE effectivery ◦ Autocomplete ◦ Refactoring
  10. • When you compile Scala code, it becomes a class

    file. • Scala PG run on the Java VM. Interaction with Java language Java VM Class file (Scala) Class file (Java) call Scala Class file compile
  11. It takes time to learn longer... Monad Complex language specification

    Type class Implicit Functional It’s too difficult!
  12. You can start to use Scala from better Java! val

    list = List(1, 2, 3, 4, 5, 6, 7, 8, 9) var sum = 0 list foreach(i => sum = sum + i) val list = List(1, 2, 3, 4, 5, 6, 7, 8, 9) val sum = list.foldLeft(0) {(s, i) => s + i} You can also use var! Let’s start to change var to val!
  13. Loadmap • Now : version 2.13.1 • Scala 3 (Dotty)

    To be released in the fall of 2020 • Next : version 2.14 For easy migration to Scala 3
  14. Finally We are hiring! Yumemi Recruit Information Welcome who want

    to work in Shizuoka with me! • Twitter : @cupperservice • E-mail : [email protected]