Share
Embed
What's scala.js?
cupper
November 16, 2019
Transcript
24 slides
-
Who am I • Name : Kazuhisa Kawashima • Home
: Shizuoka shi, aoi ku • Company : YUMEMI inc. • Job : Computer Engineer • Favorite computer language : Scala, TypeScript -
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 -
Scala.js is ... • One of the AltJS • Create
JavaScript from code written in Scala Scala JavaScript AltJS Scala.js TypeScript Kotlin.js CoffeeScript translate -
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 -
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 -
On the node.js AWS Cloud Node.js npm module Scala.js AWS
SDK for JavaScript -
On the web browser Web browser Scala.js Storage Rest Client
Framework(for instance, Vue.js) JavaScript / TypeScript View -
Scala is • Fusion of OOP and FP • Statically
typed • Interaction with Java language • It takes longer to learn than other languages -
Fusion of OOP and FP Object oriented language Procedures Data
Functional language Side effects exclude fusion State exclude -
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 -
• 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 -
It takes time to learn longer... Monad Complex language specification
Type class Implicit Functional It’s too difficult! -
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! -
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 -
Finally We are hiring! Yumemi Recruit Information Welcome who want
to work in Shizuoka with me! • Twitter : @cupperservice • E-mail : [email protected]