SlideShare a Scribd company logo
1 of 95
Download to read offline
T E N TY P TA K M A
O S Y S T E M A C H T Y P Ó W N A P R Z Y K Ł A D Z I E
T Y P E S C R I P T ’ A
A R T U R S KO W R O Ń S K I  
T H E R E A R E T W O H A R D T H I N G S
I N C O M P U T E R S C I E N C E :
P H I L K A R LT O N
C A C H E I N VA L I D AT I O N
N A M I N G T H I N G S
T H E R E A R E T W O H A R D T H I N G S
I N C O M P U T E R S C I E N C E :
P H I L K A R LT O N
C A C H E I N VA L I D AT I O N
N A M I N G T H I N G S
N A M I N G T H I N G S
O N T O L O G Y
O N T O L O G Y
  " O N T O "   O Z N A C Z A „ T O , C O J E S T ” , „ C O K O LW I E K ”
I N T O W H AT C AT E G O R I E S , I F A N Y, C A N W E S O R T
E X I S T I N G T H I N G S ?
T Y P E S T H E O RY
INTEGER
SET OF

VALUES
SET OF

OPERATIONS
TYPES
INTEGER
SET OF

VALUES
SET OF

OPERATIONS
1, 2, 3, 4, 5, 

6, 7, 8, 9, 10…
NO IMPOSSIBLE VALUES
INTEGER
TYPES
SET OF

VALUES
SET OF

OPERATIONS
INTEGER
NO IMPOSSIBLE OPERATIONS
SET OF

OPERATIONS
+, -, /, *
SET OF

VALUES
DIVISION ON INTEGER?
SET OF

OPERATIONS
INTEGER
+, -, /, *
SET OF

VALUES
W E A K & S T R O N G T Y P I N G
L I G H T W E I G H T T E C H N O L O G Y
S TAT I C & D Y N A M I C T Y P I N G
S TAT I C T Y P I N G
ASSEMBLER
HOW CAN WE PROVE THAT THIS PROGRAM WORKS?
RICE’S THEOREM (1957)
KAŻDA NIETRYWIALNA WŁASNOŚĆ JĘZYKÓW REKURENCYJNIE PRZELICZALNYCH JEST NIEROZSTRZYGALNA
S E T O F R U L E S
F O R T R A N ( 1 9 5 7 )
D ATA A R E A N N O TAT E D W I T H T Y P E I N F O
S E L F - D O C U M E N TAT I O N
F O R H U M A N S
F O R M A C H I N E S
A N Y F O O L C A N W R I T E C O D E
T H AT A C O M P U T E R C A N
U N D E R S TA N D . G O O D
P R O G R A M M E R S W R I T E C O D E
T H AT H U M A N S C A N
U N D E R S TA N D .
M A R T I N F O W L E R
S TAT I C F I L E C H E C K I N G D O N E O N C O M P I L AT I O N T I M E
SOURCE
CODE
TYPE CHECKER
TYPE CHECKER
T Y P E C H E C K E R P R O V E S C H O S E N P R O P E R T I E S
“PROVEN”
CODE
TYPE CHECKER
D O N ’ T N E E D T O B E I N C O R R E C T
?
PERFECTLY VALID PROGRAM…
let stringValue: unknown = "Value";
stringValue.trim();
…STILL WILL FAIL
let stringValue: unknown = "Value";
stringValue.trim();
…STILL WILL FAIL
let stringValue: unknown = "Value";
stringValue.trim();
L O W E R B O N D O F C O R R E C T N E S S
T R A D E O F F : E A S Y T O U S E / C O R R E C T
DIVISION ON INTEGER?
SET OF

VALUES
SET OF

OPERATIONS
SUPER-STRICT-INTEGER
+, -, /, *
N O T Y P E S I N R U N T I M E
S TAT I C & D Y N A M I C T Y P I N G
D Y N A M I C T Y P I N G
HOW CAN WE PROVE THAT THIS PROGRAM WORKS?
P R O B L E M - N O I N F O A B O U T T Y P E S I N R U N T I M E
VA R I A B L E I N C O D E
int variable = 1
RUNTIME
RUNTIME
D E C O R AT E D W I T H T Y P E O N R U N T I M E
value = 1
type = int
variable
E V E RY T H I N G I S C O R R E C T
RUNTIME
Math.abs()
value = 1
type = int
variable
R U N T I M E E X C E P T I O N
value = 1
type = int
variable
String.trim()
RUNTIME
P E R F O R M A N C E
G R A D U A L T Y P I N G
S TAT I C C O R E
D Y N A M I C N E W C O D E ( W I T H A N Y )
I N T E R O P E R A B I L I T Y W I T H J AVA S C R I P T
T Y P E E R A S U R E
S T R U C T U R A L T Y P I N G
N O M I N A L T Y P I N G
class Foo {
method(input: string): number { ... }
}
class Bar {
method(input: string): number { ... }
}
let foo: Foo = new Bar();
N O M I N A L T Y P I N G
class Foo {
method(input: string): number { ... }
}
class Bar {
method(input: string): number { ... }
}
let foo: Foo = new Bar();
N O M I N A L T Y P I N G
class Foo {
method(input: string): number { ... }
}
class Bar {
method(input: string): number { ... }
}
let foo: Foo = new Bar();
S T R U C T U R A L T Y P I N G
class Foo {
method(input: string): number { ... }
}
class Bar {
method(input: string): number { ... }
}
let foo: Foo = new Bar();
S T R U C T U R A L T Y P I N G
class Foo {
method(input: string): number { ... }
}
class Bar {
method(input: string): number { ... }
}
let foo: Foo = new Bar();
E X P L I C I T T Y P I N G
let foo: Foo = new Foo();let foo: Foo = new Foo();
M L & H I N D L E Y – M I L N E R M E T H O D
T Y P E I N F E R E N C E
IMPLICIT TYPING
let foo = new Foo();
WHAT-A-TYPE?
let a = 'x'
let b = true
let c = 3
WHAT-A-TYPE?
let a = 'x' //string
let b = true //boolean
let c = 3 //number
WHAT-A-TYPE?
const a = 'x'
const b = true
const c = 3
WHAT-A-TYPE?
const a = 'x' // ‘x’
const b = true // true
const c = 3 // 3
WITHOUT TYPE OF GUARD
let stringValue: unknown =
"Value";
stringValue.trim()
TYPE OF GUARD
function withTypeGuards(value: unknown) {
if (typeof value === "string") {
return value.trim();
}
}
TYPE OF GUARD
function withTypeGuards(value: unknown) {
if (typeof value === "string") {
return value.trim();
}
}
TYPE OF GUARD
function withTypeGuards(value: unknown) {
if (typeof value === "string") {
return value.trim();
}
}
TYPE OF GUARD
function withTypeGuards(value: unknown) {
if (typeof value === "string") {
return value.trim(); // string
}
}
PA R A M E T R I Z E D P O LY M O R P H I S M
E X . A R R AY S
let message: Array<string> = []
message.push("test");
message.push(2);
E X . A R R AY S
let message: Array<string> = []
message.push("test");
message.push(2);
E X . A R R AY S
let message: Array<string> = []
message.push("test");
message.push(2);
E X . A R R AY S
function unsafeAdd(arr: Array<string | number>): void {
arr.push(3)
}
let message: Array<string> = []
unsafeAdd(message)
const el: string = message[0]
console.log(el.toLowerCase())
U N S O U N D T Y P E S
function unsafeAdd(arr: Array<string | number>): void {
arr.push(3)
}
let message: Array<string> = []
unsafeAdd(message)
const el: string = message[1]
console.log(el.toLowerCase())
U N S O U N D T Y P E S
function unsafeAdd(arr: Array<string | number>): void {
arr.push(3)
}
let message: Array<string> = []
unsafeAdd(message)
const el: string = message[1]
console.log(el.toLowerCase())
U N S O U N D T Y P E S
function unsafeAdd(arr: Array<string | number>): void {
arr.push(3)
}
let message: Array<string> = []
unsafeAdd(message)
const el: string = message[1]
console.log(el.toLowerCase())
U N S O U N D T Y P E S
function unsafeAdd(arr: Array<string | number>): void {
arr.push(3)
}
let message: Array<string> = []
unsafeAdd(message)
const el: string = message[1]
console.log(el.toLowerCase())
U N S O U N D T Y P E S
function unsafeAdd(arr: Array<string | number>): void {
arr.push(3)
}
let message: Array<string> = []
const el: string = message[1]
console.log(el.toLowerCase())
U N S O U N D T Y P E S
function unsafeAdd(arr: Array<string | number>): void {
arr.push(3)
}
let message: Array<string> = []
unsafeAdd(message)
const el: string = message[1]
console.log(el.toLowerCase())
U N S O U N D T Y P E S
function unsafeAdd(arr: Array<string | number>): void {
arr.push(3)
}
let message: Array<string> = []
unsafeAdd(message)
const el: string = message[1]
console.log(el.toLowerCase())
U N S O U N D T Y P E S
function unsafeAdd(arr: Array<string | number>): void {
arr.push(3)
}
let message: Array<string> = []
unsafeAdd(message)
const el: string = message[0]
console.log(el.toLowerCase())
U N S O U N D T Y P E S
function unsafeAdd(arr: Array<string | number>): void {
arr.push(3)
}
let message: Array<string> = []
unsafeAdd(message)
const el: string = message[0]
console.log(el.toLowerCase())
U N S O U N D T Y P E S
function unsafeAdd(arr: Array<string | number>): void {
arr.push(3)
}
let message: Array<string> = []
unsafeAdd(message)
const el: string = message[0]
console.log(el.toLowerCase()) / int
VA L I D J S C O D E
function unsafeAdd(arr) {
arr.push(3)
}
var message = []
unsafeAdd(message)
var el = message[0]
console.log(el.toLowerCase())
S O U N D ?
H O W T O M A K E I T S O U N D
function checkIfTypeOk(el, type) {
if(!el instanceof type) throw new ClassCastException()
}
var message: Array<string> = []
unsafeAdd(message)
var el = message[0]
checkIfTypeOk(el, string)
console.log(el.toLowerCase())
H O W T O M A K E I T S O U N D
function checkIfTypeOk(el, type) {
if(!el instanceof type) throw new ClassCastException()
}
var message: Array<string> = []
unsafeAdd(message)
var el = message[0]
checkIfTypeOk(el, string)
console.log(el.toLowerCase())
H O W T O M A K E I T S O U N D
function checkIfTypeOk(el, type) {
if(!el instanceof type) throw new ClassCastException()
}
var message: Array<string> = []
unsafeAdd(message)
var el = message[0]
checkIfTypeOk(el, string)
console.log(el.toLowerCase())
H O W T O M A K E I T S O U N D
function checkIfTypeOk(el, type) {
if(!el instanceof type) throw new ClassCastException()
}
var message: Array<string> = []
unsafeAdd(message)
var el = message[0]
checkIfTypeOk(el, string)
console.log(el.toLowerCase())
T R A D E O F F : E A S Y T O U S E / C O R R E C T
C O M PAT I B L E W I T H J S
GRADUAL (STATIC WITH TYPE ERASURE)
STRUCTURALLY TYPED IMPLICITELY TYPED UNSOUND
S O U R C E S
https://www2.ccs.neu.edu/racket/pubs/ecoop2015-takikawa-et-al.pdf
https://users.soe.ucsc.edu/~abadi/Papers/FTS-submitted.pdf
UNDERSTANDING TYPESCRIPT
https://blog.steveklabnik.com/posts/2010-07-17-what-to-know-before-debating-type-systems
WHAT TO KNOW BEFORE DEBATING TYPE SYSTEMS
TOWARDS PRACTICAL GRADUAL TYPING
https://papl.cs.brown.edu/2014/safety-soundness.html
SAFETY AND SOUNDNESS
S O U R C E S
https://www2.ccs.neu.edu/racket/pubs/ecoop2015-takikawa-et-al.pdf
https://users.soe.ucsc.edu/~abadi/Papers/FTS-submitted.pdf
UNDERSTANDING TYPESCRIPT
https://blog.steveklabnik.com/posts/2010-07-17-what-to-know-before-debating-type-systems
WHAT TO KNOW BEFORE DEBATING TYPE SYSTEMS
TOWARDS PRACTICAL GRADUAL TYPING
https://papl.cs.brown.edu/2014/safety-soundness.html
SAFETY AND SOUNDNESS
Q U E S T I O N S ?
T H A N K Y O U !

More Related Content

What's hot

The Ring programming language version 1.5.4 book - Part 9 of 185
The Ring programming language version 1.5.4 book - Part 9 of 185The Ring programming language version 1.5.4 book - Part 9 of 185
The Ring programming language version 1.5.4 book - Part 9 of 185Mahmoud Samir Fayed
 
Data structures stacks
Data structures   stacksData structures   stacks
Data structures stacksmaamir farooq
 
The Ring programming language version 1.5.3 book - Part 9 of 184
The Ring programming language version 1.5.3 book - Part 9 of 184The Ring programming language version 1.5.3 book - Part 9 of 184
The Ring programming language version 1.5.3 book - Part 9 of 184Mahmoud Samir Fayed
 
Introduction to Compiler Development
Introduction to Compiler DevelopmentIntroduction to Compiler Development
Introduction to Compiler DevelopmentLogan Chien
 
кризисный центр помощи женщинам
кризисный центр помощи женщинамкризисный центр помощи женщинам
кризисный центр помощи женщинамchanna1971
 
The Ring programming language version 1.5.1 book - Part 8 of 180
The Ring programming language version 1.5.1 book - Part 8 of 180The Ring programming language version 1.5.1 book - Part 8 of 180
The Ring programming language version 1.5.1 book - Part 8 of 180Mahmoud Samir Fayed
 
LET US C (5th EDITION) CHAPTER 1 ANSWERS
LET US C (5th EDITION) CHAPTER 1 ANSWERSLET US C (5th EDITION) CHAPTER 1 ANSWERS
LET US C (5th EDITION) CHAPTER 1 ANSWERSKavyaSharma65
 
12 lec 12 loop
12 lec 12 loop 12 lec 12 loop
12 lec 12 loop kapil078
 
Breathe life into your designer!
Breathe life into your designer!Breathe life into your designer!
Breathe life into your designer!Cédric Brun
 
Programming ppt files (final)
Programming ppt files (final)Programming ppt files (final)
Programming ppt files (final)yap_raiza
 
C Language - Switch and For Loop
C Language - Switch and For LoopC Language - Switch and For Loop
C Language - Switch and For LoopSukrit Gupta
 
6 c control statements branching &amp; jumping
6 c control statements branching &amp; jumping6 c control statements branching &amp; jumping
6 c control statements branching &amp; jumpingMomenMostafa
 
Dti2143 chap 4 control statement part 2
Dti2143 chap 4 control statement part 2Dti2143 chap 4 control statement part 2
Dti2143 chap 4 control statement part 2alish sha
 
C++ control structure
C++ control structureC++ control structure
C++ control structurebluejayjunior
 
Codemania101: The Present, Past and Future of Asynchronous Programming in Python
Codemania101: The Present, Past and Future of Asynchronous Programming in PythonCodemania101: The Present, Past and Future of Asynchronous Programming in Python
Codemania101: The Present, Past and Future of Asynchronous Programming in PythonYothin Muangsommuk
 

What's hot (19)

The Ring programming language version 1.5.4 book - Part 9 of 185
The Ring programming language version 1.5.4 book - Part 9 of 185The Ring programming language version 1.5.4 book - Part 9 of 185
The Ring programming language version 1.5.4 book - Part 9 of 185
 
Data structures stacks
Data structures   stacksData structures   stacks
Data structures stacks
 
The Ring programming language version 1.5.3 book - Part 9 of 184
The Ring programming language version 1.5.3 book - Part 9 of 184The Ring programming language version 1.5.3 book - Part 9 of 184
The Ring programming language version 1.5.3 book - Part 9 of 184
 
Introduction to Compiler Development
Introduction to Compiler DevelopmentIntroduction to Compiler Development
Introduction to Compiler Development
 
кризисный центр помощи женщинам
кризисный центр помощи женщинамкризисный центр помощи женщинам
кризисный центр помощи женщинам
 
The Ring programming language version 1.5.1 book - Part 8 of 180
The Ring programming language version 1.5.1 book - Part 8 of 180The Ring programming language version 1.5.1 book - Part 8 of 180
The Ring programming language version 1.5.1 book - Part 8 of 180
 
LET US C (5th EDITION) CHAPTER 1 ANSWERS
LET US C (5th EDITION) CHAPTER 1 ANSWERSLET US C (5th EDITION) CHAPTER 1 ANSWERS
LET US C (5th EDITION) CHAPTER 1 ANSWERS
 
12 lec 12 loop
12 lec 12 loop 12 lec 12 loop
12 lec 12 loop
 
Breathe life into your designer!
Breathe life into your designer!Breathe life into your designer!
Breathe life into your designer!
 
SPL 8 | Loop Statements in C
SPL 8 | Loop Statements in CSPL 8 | Loop Statements in C
SPL 8 | Loop Statements in C
 
Programming ppt files (final)
Programming ppt files (final)Programming ppt files (final)
Programming ppt files (final)
 
C Language - Switch and For Loop
C Language - Switch and For LoopC Language - Switch and For Loop
C Language - Switch and For Loop
 
6 c control statements branching &amp; jumping
6 c control statements branching &amp; jumping6 c control statements branching &amp; jumping
6 c control statements branching &amp; jumping
 
For Loop
For LoopFor Loop
For Loop
 
Dti2143 chap 4 control statement part 2
Dti2143 chap 4 control statement part 2Dti2143 chap 4 control statement part 2
Dti2143 chap 4 control statement part 2
 
C++ control structure
C++ control structureC++ control structure
C++ control structure
 
Codemania101: The Present, Past and Future of Asynchronous Programming in Python
Codemania101: The Present, Past and Future of Asynchronous Programming in PythonCodemania101: The Present, Past and Future of Asynchronous Programming in Python
Codemania101: The Present, Past and Future of Asynchronous Programming in Python
 
week-16x
week-16xweek-16x
week-16x
 
Printf
PrintfPrintf
Printf
 

Similar to Artur Skowroński – Ten Typ tak ma - O systemach typów na przykładzie TypeScript'a

Writing (Meteor) Code With Style
Writing (Meteor) Code With StyleWriting (Meteor) Code With Style
Writing (Meteor) Code With StyleStephan Hochhaus
 
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet Pôle Systematic Paris-Region
 
No Flex Zone: Empathy Driven Development
No Flex Zone: Empathy Driven DevelopmentNo Flex Zone: Empathy Driven Development
No Flex Zone: Empathy Driven DevelopmentDuretti H.
 
Constructs and techniques and their implementation in different languages
Constructs and techniques and their implementation in different languagesConstructs and techniques and their implementation in different languages
Constructs and techniques and their implementation in different languagesOliverYoung22
 
Modeling avengers – open source technology mix for saving the world econ fr
Modeling avengers – open source technology mix for saving the world econ frModeling avengers – open source technology mix for saving the world econ fr
Modeling avengers – open source technology mix for saving the world econ frCédric Brun
 
A Beginners Guide to Weather & Climate Data, Margriet Groenendijk
A Beginners Guide to Weather & Climate Data, Margriet GroenendijkA Beginners Guide to Weather & Climate Data, Margriet Groenendijk
A Beginners Guide to Weather & Climate Data, Margriet GroenendijkPôle Systematic Paris-Region
 
Testing Fuse Fabric with Pax Exam
Testing Fuse Fabric with Pax ExamTesting Fuse Fabric with Pax Exam
Testing Fuse Fabric with Pax ExamHenryk Konsek
 
GraphQL Relay Introduction
GraphQL Relay IntroductionGraphQL Relay Introduction
GraphQL Relay IntroductionChen-Tsu Lin
 
Modeling avengers – open source technology mix for saving the world
Modeling avengers – open source technology mix for saving the worldModeling avengers – open source technology mix for saving the world
Modeling avengers – open source technology mix for saving the worldCédric Brun
 
"PyTorch Deep Learning Framework: Status and Directions," a Presentation from...
"PyTorch Deep Learning Framework: Status and Directions," a Presentation from..."PyTorch Deep Learning Framework: Status and Directions," a Presentation from...
"PyTorch Deep Learning Framework: Status and Directions," a Presentation from...Edge AI and Vision Alliance
 
009 Data Handling cs class 12 cbse mount litera
009 Data Handling cs class 12 cbse mount litera009 Data Handling cs class 12 cbse mount litera
009 Data Handling cs class 12 cbse mount literaRithinA1
 
Piotr Szotkowski about "Bits of ruby"
Piotr Szotkowski about "Bits of ruby"Piotr Szotkowski about "Bits of ruby"
Piotr Szotkowski about "Bits of ruby"Pivorak MeetUp
 
Continuous delivery with Gradle
Continuous delivery with GradleContinuous delivery with Gradle
Continuous delivery with GradleBob Paulin
 
Google Assistant & Alexa - Asystenci głosowi: możliwości, podobieństwa, różnice
Google Assistant & Alexa - Asystenci głosowi: możliwości, podobieństwa, różniceGoogle Assistant & Alexa - Asystenci głosowi: możliwości, podobieństwa, różnice
Google Assistant & Alexa - Asystenci głosowi: możliwości, podobieństwa, różniceArtur Skowroński
 
Paradigmas de Linguagens de Programacao - Aula #4
Paradigmas de Linguagens de Programacao - Aula #4Paradigmas de Linguagens de Programacao - Aula #4
Paradigmas de Linguagens de Programacao - Aula #4Ismar Silveira
 
Ember js meetup treviso liquid-fire
Ember js meetup treviso liquid-fireEmber js meetup treviso liquid-fire
Ember js meetup treviso liquid-fireWilliam Bergamo
 
So I am writing a CS code for a project and I keep getting cannot .pdf
So I am writing a CS code for a project and I keep getting cannot .pdfSo I am writing a CS code for a project and I keep getting cannot .pdf
So I am writing a CS code for a project and I keep getting cannot .pdfezonesolutions
 
PyParis - weather and climate data
PyParis - weather and climate dataPyParis - weather and climate data
PyParis - weather and climate dataMargriet Groenendijk
 

Similar to Artur Skowroński – Ten Typ tak ma - O systemach typów na przykładzie TypeScript'a (20)

Writing (Meteor) Code With Style
Writing (Meteor) Code With StyleWriting (Meteor) Code With Style
Writing (Meteor) Code With Style
 
javapravticalfile.doc
javapravticalfile.docjavapravticalfile.doc
javapravticalfile.doc
 
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
 
No Flex Zone: Empathy Driven Development
No Flex Zone: Empathy Driven DevelopmentNo Flex Zone: Empathy Driven Development
No Flex Zone: Empathy Driven Development
 
Constructs and techniques and their implementation in different languages
Constructs and techniques and their implementation in different languagesConstructs and techniques and their implementation in different languages
Constructs and techniques and their implementation in different languages
 
JavaFX, because you're worth it
JavaFX, because you're worth itJavaFX, because you're worth it
JavaFX, because you're worth it
 
Modeling avengers – open source technology mix for saving the world econ fr
Modeling avengers – open source technology mix for saving the world econ frModeling avengers – open source technology mix for saving the world econ fr
Modeling avengers – open source technology mix for saving the world econ fr
 
A Beginners Guide to Weather & Climate Data, Margriet Groenendijk
A Beginners Guide to Weather & Climate Data, Margriet GroenendijkA Beginners Guide to Weather & Climate Data, Margriet Groenendijk
A Beginners Guide to Weather & Climate Data, Margriet Groenendijk
 
Testing Fuse Fabric with Pax Exam
Testing Fuse Fabric with Pax ExamTesting Fuse Fabric with Pax Exam
Testing Fuse Fabric with Pax Exam
 
GraphQL Relay Introduction
GraphQL Relay IntroductionGraphQL Relay Introduction
GraphQL Relay Introduction
 
Modeling avengers – open source technology mix for saving the world
Modeling avengers – open source technology mix for saving the worldModeling avengers – open source technology mix for saving the world
Modeling avengers – open source technology mix for saving the world
 
"PyTorch Deep Learning Framework: Status and Directions," a Presentation from...
"PyTorch Deep Learning Framework: Status and Directions," a Presentation from..."PyTorch Deep Learning Framework: Status and Directions," a Presentation from...
"PyTorch Deep Learning Framework: Status and Directions," a Presentation from...
 
009 Data Handling cs class 12 cbse mount litera
009 Data Handling cs class 12 cbse mount litera009 Data Handling cs class 12 cbse mount litera
009 Data Handling cs class 12 cbse mount litera
 
Piotr Szotkowski about "Bits of ruby"
Piotr Szotkowski about "Bits of ruby"Piotr Szotkowski about "Bits of ruby"
Piotr Szotkowski about "Bits of ruby"
 
Continuous delivery with Gradle
Continuous delivery with GradleContinuous delivery with Gradle
Continuous delivery with Gradle
 
Google Assistant & Alexa - Asystenci głosowi: możliwości, podobieństwa, różnice
Google Assistant & Alexa - Asystenci głosowi: możliwości, podobieństwa, różniceGoogle Assistant & Alexa - Asystenci głosowi: możliwości, podobieństwa, różnice
Google Assistant & Alexa - Asystenci głosowi: możliwości, podobieństwa, różnice
 
Paradigmas de Linguagens de Programacao - Aula #4
Paradigmas de Linguagens de Programacao - Aula #4Paradigmas de Linguagens de Programacao - Aula #4
Paradigmas de Linguagens de Programacao - Aula #4
 
Ember js meetup treviso liquid-fire
Ember js meetup treviso liquid-fireEmber js meetup treviso liquid-fire
Ember js meetup treviso liquid-fire
 
So I am writing a CS code for a project and I keep getting cannot .pdf
So I am writing a CS code for a project and I keep getting cannot .pdfSo I am writing a CS code for a project and I keep getting cannot .pdf
So I am writing a CS code for a project and I keep getting cannot .pdf
 
PyParis - weather and climate data
PyParis - weather and climate dataPyParis - weather and climate data
PyParis - weather and climate data
 

More from Artur Skowroński

Kopiąc Trufle - Odkrywanie tajemnic najmniej zrozumiałego elementu GraalVM
Kopiąc Trufle - Odkrywanie tajemnic najmniej zrozumiałego elementu GraalVMKopiąc Trufle - Odkrywanie tajemnic najmniej zrozumiałego elementu GraalVM
Kopiąc Trufle - Odkrywanie tajemnic najmniej zrozumiałego elementu GraalVMArtur Skowroński
 
The State of the Green IT at the beginning of 2024
The State of the Green IT at the beginning of 2024The State of the Green IT at the beginning of 2024
The State of the Green IT at the beginning of 2024Artur Skowroński
 
My chcemy grać w Zielone! Czyli stan świata Green Technology końcówką 2023
My chcemy grać w Zielone! Czyli stan świata Green Technology końcówką 2023My chcemy grać w Zielone! Czyli stan świata Green Technology końcówką 2023
My chcemy grać w Zielone! Czyli stan świata Green Technology końcówką 2023Artur Skowroński
 
GraalVM, CRaC, Leyden and friends
GraalVM, CRaC, Leyden and friendsGraalVM, CRaC, Leyden and friends
GraalVM, CRaC, Leyden and friendsArtur Skowroński
 
Od Czarnoksiężnik z krainy Oz do modeli na produkcji
Od Czarnoksiężnik z krainy Oz do modeli na produkcjiOd Czarnoksiężnik z krainy Oz do modeli na produkcji
Od Czarnoksiężnik z krainy Oz do modeli na produkcjiArtur Skowroński
 
JVM Iceberg... we need to go deeper
JVM Iceberg... we need to go deeperJVM Iceberg... we need to go deeper
JVM Iceberg... we need to go deeperArtur Skowroński
 
JVM Iceberg... we need to go deeper
JVM Iceberg... we need to go deeperJVM Iceberg... we need to go deeper
JVM Iceberg... we need to go deeperArtur Skowroński
 
Panie, kto tu Panu tak ... - czyli porozmawiajmy o Legacy
Panie, kto tu Panu tak ... - czyli porozmawiajmy o LegacyPanie, kto tu Panu tak ... - czyli porozmawiajmy o Legacy
Panie, kto tu Panu tak ... - czyli porozmawiajmy o LegacyArtur Skowroński
 
Panie, kto tu Panu tak ... - czyli porozmawiajmy o Legacy
Panie, kto tu Panu tak ... - czyli porozmawiajmy o LegacyPanie, kto tu Panu tak ... - czyli porozmawiajmy o Legacy
Panie, kto tu Panu tak ... - czyli porozmawiajmy o LegacyArtur Skowroński
 
Ciąg dalszy nastąpi - o wielowątkowości, Projekcie Loom i kotlinowych Korutynach
Ciąg dalszy nastąpi - o wielowątkowości, Projekcie Loom i kotlinowych KorutynachCiąg dalszy nastąpi - o wielowątkowości, Projekcie Loom i kotlinowych Korutynach
Ciąg dalszy nastąpi - o wielowątkowości, Projekcie Loom i kotlinowych KorutynachArtur Skowroński
 
Ten Typ tak ma - O systemach typów na przykładzie TypeScript’a
Ten Typ tak ma - O systemach typów na przykładzie TypeScript’aTen Typ tak ma - O systemach typów na przykładzie TypeScript’a
Ten Typ tak ma - O systemach typów na przykładzie TypeScript’aArtur Skowroński
 
Google Assistant po polsku - developerski punkt widzenia
Google Assistant po polsku - developerski punkt widzeniaGoogle Assistant po polsku - developerski punkt widzenia
Google Assistant po polsku - developerski punkt widzeniaArtur Skowroński
 
To Be Continued - multithreading with Project Loom and Kotlin's Coroutines
To Be Continued - multithreading with Project Loom and Kotlin's CoroutinesTo Be Continued - multithreading with Project Loom and Kotlin's Coroutines
To Be Continued - multithreading with Project Loom and Kotlin's CoroutinesArtur Skowroński
 
To be Continued - multithreading with Project Loom and Kotlin's Coroutines
To be Continued - multithreading with Project Loom and Kotlin's CoroutinesTo be Continued - multithreading with Project Loom and Kotlin's Coroutines
To be Continued - multithreading with Project Loom and Kotlin's CoroutinesArtur Skowroński
 
Blockchain: Developer's Perspective (Java Edition)
Blockchain: Developer's Perspective (Java Edition)Blockchain: Developer's Perspective (Java Edition)
Blockchain: Developer's Perspective (Java Edition)Artur Skowroński
 
Blockchain: Developer Perspective
Blockchain: Developer PerspectiveBlockchain: Developer Perspective
Blockchain: Developer PerspectiveArtur Skowroński
 
Alexa, nice to meet(js) you!
Alexa, nice to meet(js) you!Alexa, nice to meet(js) you!
Alexa, nice to meet(js) you!Artur Skowroński
 
Change Detection Anno Domini 2016
Change Detection Anno Domini 2016Change Detection Anno Domini 2016
Change Detection Anno Domini 2016Artur Skowroński
 
Embracing change - how to introduce Clojure into your company technology stac...
Embracing change - how to introduce Clojure into your company technology stac...Embracing change - how to introduce Clojure into your company technology stac...
Embracing change - how to introduce Clojure into your company technology stac...Artur Skowroński
 

More from Artur Skowroński (20)

Kopiąc Trufle - Odkrywanie tajemnic najmniej zrozumiałego elementu GraalVM
Kopiąc Trufle - Odkrywanie tajemnic najmniej zrozumiałego elementu GraalVMKopiąc Trufle - Odkrywanie tajemnic najmniej zrozumiałego elementu GraalVM
Kopiąc Trufle - Odkrywanie tajemnic najmniej zrozumiałego elementu GraalVM
 
The State of the Green IT at the beginning of 2024
The State of the Green IT at the beginning of 2024The State of the Green IT at the beginning of 2024
The State of the Green IT at the beginning of 2024
 
My chcemy grać w Zielone! Czyli stan świata Green Technology końcówką 2023
My chcemy grać w Zielone! Czyli stan świata Green Technology końcówką 2023My chcemy grać w Zielone! Czyli stan świata Green Technology końcówką 2023
My chcemy grać w Zielone! Czyli stan świata Green Technology końcówką 2023
 
GraalVM, CRaC, Leyden and friends
GraalVM, CRaC, Leyden and friendsGraalVM, CRaC, Leyden and friends
GraalVM, CRaC, Leyden and friends
 
Od Czarnoksiężnik z krainy Oz do modeli na produkcji
Od Czarnoksiężnik z krainy Oz do modeli na produkcjiOd Czarnoksiężnik z krainy Oz do modeli na produkcji
Od Czarnoksiężnik z krainy Oz do modeli na produkcji
 
JVM Iceberg... we need to go deeper
JVM Iceberg... we need to go deeperJVM Iceberg... we need to go deeper
JVM Iceberg... we need to go deeper
 
JVM Iceberg... we need to go deeper
JVM Iceberg... we need to go deeperJVM Iceberg... we need to go deeper
JVM Iceberg... we need to go deeper
 
Panie, kto tu Panu tak ... - czyli porozmawiajmy o Legacy
Panie, kto tu Panu tak ... - czyli porozmawiajmy o LegacyPanie, kto tu Panu tak ... - czyli porozmawiajmy o Legacy
Panie, kto tu Panu tak ... - czyli porozmawiajmy o Legacy
 
Panie, kto tu Panu tak ... - czyli porozmawiajmy o Legacy
Panie, kto tu Panu tak ... - czyli porozmawiajmy o LegacyPanie, kto tu Panu tak ... - czyli porozmawiajmy o Legacy
Panie, kto tu Panu tak ... - czyli porozmawiajmy o Legacy
 
Ciąg dalszy nastąpi - o wielowątkowości, Projekcie Loom i kotlinowych Korutynach
Ciąg dalszy nastąpi - o wielowątkowości, Projekcie Loom i kotlinowych KorutynachCiąg dalszy nastąpi - o wielowątkowości, Projekcie Loom i kotlinowych Korutynach
Ciąg dalszy nastąpi - o wielowątkowości, Projekcie Loom i kotlinowych Korutynach
 
Ten Typ tak ma - O systemach typów na przykładzie TypeScript’a
Ten Typ tak ma - O systemach typów na przykładzie TypeScript’aTen Typ tak ma - O systemach typów na przykładzie TypeScript’a
Ten Typ tak ma - O systemach typów na przykładzie TypeScript’a
 
Google Assistant po polsku - developerski punkt widzenia
Google Assistant po polsku - developerski punkt widzeniaGoogle Assistant po polsku - developerski punkt widzenia
Google Assistant po polsku - developerski punkt widzenia
 
To Be Continued - multithreading with Project Loom and Kotlin's Coroutines
To Be Continued - multithreading with Project Loom and Kotlin's CoroutinesTo Be Continued - multithreading with Project Loom and Kotlin's Coroutines
To Be Continued - multithreading with Project Loom and Kotlin's Coroutines
 
To be Continued - multithreading with Project Loom and Kotlin's Coroutines
To be Continued - multithreading with Project Loom and Kotlin's CoroutinesTo be Continued - multithreading with Project Loom and Kotlin's Coroutines
To be Continued - multithreading with Project Loom and Kotlin's Coroutines
 
Blockchain: Developer's Perspective (Java Edition)
Blockchain: Developer's Perspective (Java Edition)Blockchain: Developer's Perspective (Java Edition)
Blockchain: Developer's Perspective (Java Edition)
 
Blockchain: Developer Perspective
Blockchain: Developer PerspectiveBlockchain: Developer Perspective
Blockchain: Developer Perspective
 
Alexa, nice to meet you!
Alexa, nice to meet you! Alexa, nice to meet you!
Alexa, nice to meet you!
 
Alexa, nice to meet(js) you!
Alexa, nice to meet(js) you!Alexa, nice to meet(js) you!
Alexa, nice to meet(js) you!
 
Change Detection Anno Domini 2016
Change Detection Anno Domini 2016Change Detection Anno Domini 2016
Change Detection Anno Domini 2016
 
Embracing change - how to introduce Clojure into your company technology stac...
Embracing change - how to introduce Clojure into your company technology stac...Embracing change - how to introduce Clojure into your company technology stac...
Embracing change - how to introduce Clojure into your company technology stac...
 

Recently uploaded

Engineering Drawing section of solid
Engineering Drawing     section of solidEngineering Drawing     section of solid
Engineering Drawing section of solidnamansinghjarodiya
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptMadan Karki
 
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdf
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdfPaper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdf
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdfNainaShrivastava14
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxsiddharthjain2303
 
Ch10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfCh10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfChristianCDAM
 
List of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfList of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfisabel213075
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfDrew Moseley
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxRomil Mishra
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating SystemRashmi Bhat
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating SystemRashmi Bhat
 
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Sumanth A
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substationstephanwindworld
 
CS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfCS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfBalamuruganV28
 
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfModule-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfManish Kumar
 
Python Programming for basic beginners.pptx
Python Programming for basic beginners.pptxPython Programming for basic beginners.pptx
Python Programming for basic beginners.pptxmohitesoham12
 
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfComprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfalene1
 
System Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingSystem Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingBootNeck1
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Coursebim.edu.pl
 
Artificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewArtificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewsandhya757531
 
OOP concepts -in-Python programming language
OOP concepts -in-Python programming languageOOP concepts -in-Python programming language
OOP concepts -in-Python programming languageSmritiSharma901052
 

Recently uploaded (20)

Engineering Drawing section of solid
Engineering Drawing     section of solidEngineering Drawing     section of solid
Engineering Drawing section of solid
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.ppt
 
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdf
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdfPaper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdf
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdf
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptx
 
Ch10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfCh10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdf
 
List of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfList of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdf
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdf
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptx
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating System
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating System
 
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substation
 
CS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfCS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdf
 
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfModule-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
 
Python Programming for basic beginners.pptx
Python Programming for basic beginners.pptxPython Programming for basic beginners.pptx
Python Programming for basic beginners.pptx
 
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfComprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
 
System Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingSystem Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event Scheduling
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Course
 
Artificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewArtificial Intelligence in Power System overview
Artificial Intelligence in Power System overview
 
OOP concepts -in-Python programming language
OOP concepts -in-Python programming languageOOP concepts -in-Python programming language
OOP concepts -in-Python programming language
 

Artur Skowroński – Ten Typ tak ma - O systemach typów na przykładzie TypeScript'a

  • 1. T E N TY P TA K M A O S Y S T E M A C H T Y P Ó W N A P R Z Y K Ł A D Z I E T Y P E S C R I P T ’ A A R T U R S KO W R O Ń S K I  
  • 2. T H E R E A R E T W O H A R D T H I N G S I N C O M P U T E R S C I E N C E : P H I L K A R LT O N C A C H E I N VA L I D AT I O N N A M I N G T H I N G S
  • 3. T H E R E A R E T W O H A R D T H I N G S I N C O M P U T E R S C I E N C E : P H I L K A R LT O N C A C H E I N VA L I D AT I O N N A M I N G T H I N G S
  • 4. N A M I N G T H I N G S
  • 5. O N T O L O G Y
  • 6. O N T O L O G Y   " O N T O "   O Z N A C Z A „ T O , C O J E S T ” , „ C O K O LW I E K ”
  • 7. I N T O W H AT C AT E G O R I E S , I F A N Y, C A N W E S O R T E X I S T I N G T H I N G S ?
  • 8.
  • 9. T Y P E S T H E O RY
  • 11. INTEGER SET OF
 VALUES SET OF
 OPERATIONS 1, 2, 3, 4, 5, 
 6, 7, 8, 9, 10… NO IMPOSSIBLE VALUES
  • 13. INTEGER NO IMPOSSIBLE OPERATIONS SET OF
 OPERATIONS +, -, /, * SET OF
 VALUES
  • 14. DIVISION ON INTEGER? SET OF
 OPERATIONS INTEGER +, -, /, * SET OF
 VALUES
  • 15. W E A K & S T R O N G T Y P I N G
  • 16. L I G H T W E I G H T T E C H N O L O G Y
  • 17. S TAT I C & D Y N A M I C T Y P I N G
  • 18. S TAT I C T Y P I N G
  • 20. HOW CAN WE PROVE THAT THIS PROGRAM WORKS?
  • 21. RICE’S THEOREM (1957) KAŻDA NIETRYWIALNA WŁASNOŚĆ JĘZYKÓW REKURENCYJNIE PRZELICZALNYCH JEST NIEROZSTRZYGALNA
  • 22. S E T O F R U L E S
  • 23. F O R T R A N ( 1 9 5 7 )
  • 24. D ATA A R E A N N O TAT E D W I T H T Y P E I N F O
  • 25. S E L F - D O C U M E N TAT I O N
  • 26. F O R H U M A N S
  • 27. F O R M A C H I N E S
  • 28. A N Y F O O L C A N W R I T E C O D E T H AT A C O M P U T E R C A N U N D E R S TA N D . G O O D P R O G R A M M E R S W R I T E C O D E T H AT H U M A N S C A N U N D E R S TA N D . M A R T I N F O W L E R
  • 29. S TAT I C F I L E C H E C K I N G D O N E O N C O M P I L AT I O N T I M E SOURCE CODE TYPE CHECKER
  • 30. TYPE CHECKER T Y P E C H E C K E R P R O V E S C H O S E N P R O P E R T I E S “PROVEN” CODE
  • 31. TYPE CHECKER D O N ’ T N E E D T O B E I N C O R R E C T ?
  • 32. PERFECTLY VALID PROGRAM… let stringValue: unknown = "Value"; stringValue.trim();
  • 33. …STILL WILL FAIL let stringValue: unknown = "Value"; stringValue.trim();
  • 34. …STILL WILL FAIL let stringValue: unknown = "Value"; stringValue.trim();
  • 35. L O W E R B O N D O F C O R R E C T N E S S
  • 36. T R A D E O F F : E A S Y T O U S E / C O R R E C T
  • 37. DIVISION ON INTEGER? SET OF
 VALUES SET OF
 OPERATIONS SUPER-STRICT-INTEGER +, -, /, *
  • 38. N O T Y P E S I N R U N T I M E
  • 39. S TAT I C & D Y N A M I C T Y P I N G
  • 40. D Y N A M I C T Y P I N G
  • 41. HOW CAN WE PROVE THAT THIS PROGRAM WORKS?
  • 42. P R O B L E M - N O I N F O A B O U T T Y P E S I N R U N T I M E
  • 43. VA R I A B L E I N C O D E int variable = 1 RUNTIME
  • 44. RUNTIME D E C O R AT E D W I T H T Y P E O N R U N T I M E value = 1 type = int variable
  • 45. E V E RY T H I N G I S C O R R E C T RUNTIME Math.abs() value = 1 type = int variable
  • 46. R U N T I M E E X C E P T I O N value = 1 type = int variable String.trim() RUNTIME
  • 47. P E R F O R M A N C E
  • 48. G R A D U A L T Y P I N G
  • 49. S TAT I C C O R E
  • 50. D Y N A M I C N E W C O D E ( W I T H A N Y )
  • 51. I N T E R O P E R A B I L I T Y W I T H J AVA S C R I P T
  • 52. T Y P E E R A S U R E
  • 53. S T R U C T U R A L T Y P I N G
  • 54. N O M I N A L T Y P I N G class Foo { method(input: string): number { ... } } class Bar { method(input: string): number { ... } } let foo: Foo = new Bar();
  • 55. N O M I N A L T Y P I N G class Foo { method(input: string): number { ... } } class Bar { method(input: string): number { ... } } let foo: Foo = new Bar();
  • 56. N O M I N A L T Y P I N G class Foo { method(input: string): number { ... } } class Bar { method(input: string): number { ... } } let foo: Foo = new Bar();
  • 57. S T R U C T U R A L T Y P I N G class Foo { method(input: string): number { ... } } class Bar { method(input: string): number { ... } } let foo: Foo = new Bar();
  • 58. S T R U C T U R A L T Y P I N G class Foo { method(input: string): number { ... } } class Bar { method(input: string): number { ... } } let foo: Foo = new Bar();
  • 59. E X P L I C I T T Y P I N G let foo: Foo = new Foo();let foo: Foo = new Foo();
  • 60. M L & H I N D L E Y – M I L N E R M E T H O D T Y P E I N F E R E N C E
  • 61. IMPLICIT TYPING let foo = new Foo();
  • 62. WHAT-A-TYPE? let a = 'x' let b = true let c = 3
  • 63. WHAT-A-TYPE? let a = 'x' //string let b = true //boolean let c = 3 //number
  • 64. WHAT-A-TYPE? const a = 'x' const b = true const c = 3
  • 65. WHAT-A-TYPE? const a = 'x' // ‘x’ const b = true // true const c = 3 // 3
  • 66. WITHOUT TYPE OF GUARD let stringValue: unknown = "Value"; stringValue.trim()
  • 67. TYPE OF GUARD function withTypeGuards(value: unknown) { if (typeof value === "string") { return value.trim(); } }
  • 68. TYPE OF GUARD function withTypeGuards(value: unknown) { if (typeof value === "string") { return value.trim(); } }
  • 69. TYPE OF GUARD function withTypeGuards(value: unknown) { if (typeof value === "string") { return value.trim(); } }
  • 70. TYPE OF GUARD function withTypeGuards(value: unknown) { if (typeof value === "string") { return value.trim(); // string } }
  • 71. PA R A M E T R I Z E D P O LY M O R P H I S M
  • 72. E X . A R R AY S let message: Array<string> = [] message.push("test"); message.push(2);
  • 73. E X . A R R AY S let message: Array<string> = [] message.push("test"); message.push(2);
  • 74. E X . A R R AY S let message: Array<string> = [] message.push("test"); message.push(2);
  • 75. E X . A R R AY S function unsafeAdd(arr: Array<string | number>): void { arr.push(3) } let message: Array<string> = [] unsafeAdd(message) const el: string = message[0] console.log(el.toLowerCase())
  • 76. U N S O U N D T Y P E S function unsafeAdd(arr: Array<string | number>): void { arr.push(3) } let message: Array<string> = [] unsafeAdd(message) const el: string = message[1] console.log(el.toLowerCase())
  • 77. U N S O U N D T Y P E S function unsafeAdd(arr: Array<string | number>): void { arr.push(3) } let message: Array<string> = [] unsafeAdd(message) const el: string = message[1] console.log(el.toLowerCase())
  • 78. U N S O U N D T Y P E S function unsafeAdd(arr: Array<string | number>): void { arr.push(3) } let message: Array<string> = [] unsafeAdd(message) const el: string = message[1] console.log(el.toLowerCase())
  • 79. U N S O U N D T Y P E S function unsafeAdd(arr: Array<string | number>): void { arr.push(3) } let message: Array<string> = [] unsafeAdd(message) const el: string = message[1] console.log(el.toLowerCase())
  • 80. U N S O U N D T Y P E S function unsafeAdd(arr: Array<string | number>): void { arr.push(3) } let message: Array<string> = [] const el: string = message[1] console.log(el.toLowerCase())
  • 81. U N S O U N D T Y P E S function unsafeAdd(arr: Array<string | number>): void { arr.push(3) } let message: Array<string> = [] unsafeAdd(message) const el: string = message[1] console.log(el.toLowerCase())
  • 82. U N S O U N D T Y P E S function unsafeAdd(arr: Array<string | number>): void { arr.push(3) } let message: Array<string> = [] unsafeAdd(message) const el: string = message[1] console.log(el.toLowerCase())
  • 83. U N S O U N D T Y P E S function unsafeAdd(arr: Array<string | number>): void { arr.push(3) } let message: Array<string> = [] unsafeAdd(message) const el: string = message[0] console.log(el.toLowerCase())
  • 84. U N S O U N D T Y P E S function unsafeAdd(arr: Array<string | number>): void { arr.push(3) } let message: Array<string> = [] unsafeAdd(message) const el: string = message[0] console.log(el.toLowerCase())
  • 85. U N S O U N D T Y P E S function unsafeAdd(arr: Array<string | number>): void { arr.push(3) } let message: Array<string> = [] unsafeAdd(message) const el: string = message[0] console.log(el.toLowerCase()) / int
  • 86. VA L I D J S C O D E function unsafeAdd(arr) { arr.push(3) } var message = [] unsafeAdd(message) var el = message[0] console.log(el.toLowerCase())
  • 87. S O U N D ?
  • 88. H O W T O M A K E I T S O U N D function checkIfTypeOk(el, type) { if(!el instanceof type) throw new ClassCastException() } var message: Array<string> = [] unsafeAdd(message) var el = message[0] checkIfTypeOk(el, string) console.log(el.toLowerCase())
  • 89. H O W T O M A K E I T S O U N D function checkIfTypeOk(el, type) { if(!el instanceof type) throw new ClassCastException() } var message: Array<string> = [] unsafeAdd(message) var el = message[0] checkIfTypeOk(el, string) console.log(el.toLowerCase())
  • 90. H O W T O M A K E I T S O U N D function checkIfTypeOk(el, type) { if(!el instanceof type) throw new ClassCastException() } var message: Array<string> = [] unsafeAdd(message) var el = message[0] checkIfTypeOk(el, string) console.log(el.toLowerCase())
  • 91. H O W T O M A K E I T S O U N D function checkIfTypeOk(el, type) { if(!el instanceof type) throw new ClassCastException() } var message: Array<string> = [] unsafeAdd(message) var el = message[0] checkIfTypeOk(el, string) console.log(el.toLowerCase())
  • 92. T R A D E O F F : E A S Y T O U S E / C O R R E C T C O M PAT I B L E W I T H J S
  • 93. GRADUAL (STATIC WITH TYPE ERASURE) STRUCTURALLY TYPED IMPLICITELY TYPED UNSOUND
  • 94. S O U R C E S https://www2.ccs.neu.edu/racket/pubs/ecoop2015-takikawa-et-al.pdf https://users.soe.ucsc.edu/~abadi/Papers/FTS-submitted.pdf UNDERSTANDING TYPESCRIPT https://blog.steveklabnik.com/posts/2010-07-17-what-to-know-before-debating-type-systems WHAT TO KNOW BEFORE DEBATING TYPE SYSTEMS TOWARDS PRACTICAL GRADUAL TYPING https://papl.cs.brown.edu/2014/safety-soundness.html SAFETY AND SOUNDNESS
  • 95. S O U R C E S https://www2.ccs.neu.edu/racket/pubs/ecoop2015-takikawa-et-al.pdf https://users.soe.ucsc.edu/~abadi/Papers/FTS-submitted.pdf UNDERSTANDING TYPESCRIPT https://blog.steveklabnik.com/posts/2010-07-17-what-to-know-before-debating-type-systems WHAT TO KNOW BEFORE DEBATING TYPE SYSTEMS TOWARDS PRACTICAL GRADUAL TYPING https://papl.cs.brown.edu/2014/safety-soundness.html SAFETY AND SOUNDNESS Q U E S T I O N S ? T H A N K Y O U !