Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Agregando tipos a JS
Search
Franco Castellacci
June 01, 2017
Programming
30
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Agregando tipos a JS
Franco Castellacci
June 01, 2017
Other Decks in Programming
See All in Programming
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
140
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
150
R8 の設定見直しでアプリサイズ削減
andpad
0
220
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
ChromeでローカルLLM
ryu1013
0
140
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
500
sbt 2.0: takeoff
eed3si9n
0
160
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
750
contenteditable と日本語入力に向き合う
colorful12
0
200
パズルゲームの作り方 / how to make puzzle games
kaityo256
PRO
2
290
APNsからLive Activityを開始する話
yumnumm
0
170
Unity6 URPによる海底をテーマにしたVJシステムの解説 | Unity Shader 完全に理解した 勉強会
gam0022
0
370
Featured
See All Featured
Claude Code のすすめ
schroneko
67
230k
Design in an AI World
tapps
1
350
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.2k
Prompt Engineering for Job Search
mfonobong
0
520
How GitHub (no longer) Works
holman
316
150k
sira's awesome portfolio website redesign presentation
elsirapls
0
460
Ruling the World: When Life Gets Gamed
codingconduct
0
400
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
800
Amusing Abliteration
ianozsvald
1
350
The World Runs on Bad Software
bkeepers
PRO
72
12k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
460
Transcript
@fcastellacci
None
None
None
None
None
None
None
I was here
• ✓ • ✓ • conservative ✓ • ✓✓
None
• • • • •
• • •
function add(x/** @type {int} */, y/** @type {int} */) {
var f = x + 0.5; return x + y + f/** @type {float} */; }
var int = 1; /** @type {int} */ var float
= 1.5; /** @type {float} */ var bool = true; /** @type {bool} */ var string = "a string"; /** @type {str} */ var intArr = [1, 2]; /** @type {array<int>} */ var floatArr = [1.5, 2.5]; /** @type {array<float>} */ var obj = {} /** @type {obj} */
Types + Type info Faster (?) + + Type info
+ Type info
• this.state /** @type {int} */ = this.state /** @type
{int} */ & STATE_NOT_HELD /** @type {int} */; s3[LikelyCanBeTaggedValue_Int] = LdFld s7(s2<s10>[Object]->state)[LikelyCanBeTaggedValue_Int] Bailout: (BailOutFailedEquivalentTypeCheck) s4[LikelyCanBeTaggedValue_Int] = LdRootFld s8(s1[Object]->STATE_NOT_HELD)[LikelyCanBeTaggedValue_Int] s14(s3).i32 = FromVar s3[LikelyCanBeTaggedValue_Int] Bailout: (BailOutOnNotPrimitive) s15(s4).i32 = FromVar s4[LikelyCanBeTaggedValue_Int] Bailout: (BailOutOnNotPrimitive)
• this.state /** @type {int} */ = this.state /** @type
{int} */ & STATE_NOT_HELD /** @type {int} */; s3[CanBeTaggedValue_Int] = LdFld s7(s2<s10>[Object]->state)[CanBeTaggedValue_Int] Bailout: (BailOutFailedEquivalentTypeCheck) s4[CanBeTaggedValue_Int] = LdRootFld s8(s1[Object]->STATE_NOT_HELD)[CanBeTaggedValue_Int] s14(s3).i32 = FromVar s3[CanBeTaggedValue_Int] s15(s4).i32 = FromVar s4[CanBeTaggedValue_Int]
GLOBOPT INSTR: s14(s3).i32 = FromVar s3[LikelyCanBeTaggedValue_Int].var ) s30[LikelyCanBeTaggedValue_Int].var = MOV
s3[LikelyCanBeTaggedValue_Int].var s31.i64 = MOV s30[LikelyCanBeTaggedValue_Int].var # s31.i64 = SHR s31.i64, 48 (0x30).i8 # CMP s31.i64, 1 (0x1).i32 # JNE $L7 # s14(s3).i32 = MOV_TRUNC s30[LikelyCanBeTaggedValue_Int].i32 # JMP $L8 # $L7: [helper] # s32.i64 = LEA s20<-9>.u8 # s33.i64 = MOV s32.i64 # s34.var = MOV s3[LikelyCanBeTaggedValue_Int].var # arg3(s36)(r8).i64 = MOV s33.i64 # arg2(s37)(rdx).u64 = MOV 0xXXXXXXXX (ScriptContext).u64 # arg1(s38)(rcx).var = MOV s34.var # s39(rax).u64 = MOV Conv_ToInt32_NoObjects.u64 # s35(rax).i32 = CALL s39(rax).u64 # s14(s3).i32 = MOV s35(rax).i32 # s40.u8 = MOV s20<-9>.u8 # TEST s40.u8, s40.u8 # JEQ $L8 # $L9: [helper] # CALL SaveAllRegistersAndBailOut.u64 # Bailout: #0013 (BailOutOnNotPrimitive) JMP $L6 # $L8: # GLOBOPT INSTR: s14(s3).i32 = FromVar s3[CanBeTaggedValue_Int].var! s19[CanBeTaggedValue_Int].var = MOV s3[CanBeTaggedValue_Int].var s14(s3).i32 = MOV_TRUNC s19[CanBeTaggedValue_Int].i32 21 vs 2
None
None
• ◦ • ◦ • ◦ ◦
None
None
None
• ◦ • ◦ • ◦ •
None
None
None
None
None
▪ public addDeviceTask(id: Int, priority: Int, queue: Packet) { this.addTask(id,
priority, queue, new DeviceTask(this)); } Scheduler.prototype.addDeviceTask = function (id/** @type {int} */, priority/** @type {int} */, queue/** @type {obj} */) { this.addTask(id/** @type {int} */, priority/** @type {int} */, queue, new DeviceTask(this)); }; ▪
• • Interface Int extends Number {} Interface Float extends
Number {}
None
None
None
• • • •
• • • • • • •
None