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
TypedCoffeeScriptって、あったらよくないですか
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Koutarou Chikuba
June 08, 2014
Technology
11k
7
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
TypedCoffeeScriptって、あったらよくないですか
altjs武闘会
Koutarou Chikuba
June 08, 2014
Transcript
24 slides
TypedCoffeeScriptͬͯɺ͋ͬͨΒΑ ͘ͳ͍Ͱ͔͢ @mizchi altjsಆձ
About&me • @mizchi • ओʹϑϩϯτΤϯυΤϯδχΞ • AltJSϚχΞ • ࠷ۙLLVMphaser.js(WebGLͷ2dήʔϜΤϯδϯ)ʹڵຯ
TypedCoffeeScript ͱ
ͳʹ͜Ε? • mizchi/TypedCoffeeScript • ʮܕ͖ʯCoffeeScript • CoffeeScriptͷεʔύʔηοτ(ݩͷcoffeeશ෦௨͢) • CoffeeScriptͷจ๏.+.TypeScript෩Subtyping •
൵؍తܕਪ(ޙड़) • ੩తղੳ
CoffeeScript:,એݴ n = 42 p = x: 1, y: 2
TypeCoffeeScript:.એݴ n :: Number = 42 struct Point x ::
Int y :: Int p :: Point = x: 1, y: 2
TypedCoffeeScriptԿΛ͔ͨ͠ʁ • ܕΞϊςʔγϣϯͷղऍ • ߏମએݴ • ೖ࣌ܕνΣοΫ • ΦϒδΣΫτϦςϥϧͷਪ •
Int%&>%NumberͷμϯΩϟετ(Number%:>%Float%:>%Int)
CoffeeScript:,ؔ {sqrt, pow} = Math distance = (from, to) ->
sqrt pow(from.x - to.x, 2) + pow(from.y - to.y, 2) console.log distance {x: 0, y: 0}, {x: 3, y: 4} #=> 5
TypedCoffeeScript:/ؔ sqrt :: Number * Number -> Float pow ::
(Number, Number) -> Float {sqrt, pow} = Math distance :: Point * Point -> Float distance = (from, to) -> sqrt pow(from.x - to.x, 2) + pow(from.y - to.y, 2) console.log distance {x: 0, y: 0}, {x: 3, y: 4} #=> 5
TypedCoffeeScript:/ؔ foo = Int -> Int -> Int foo =
(m) -> (n) -> m * n n :: Int = foo(3)(2) ͜Μͳ͜ͱ
TypedCoffeeScriptԿΛ͔ͨ͠ʁ • લஔܕΞϊςʔγϣϯ • BinaryOperatorͷਪ:.(+.Float.Float).4>.Float • ؔࣜͷܕνΣοΫ • ؔద༻ͷܕνΣοΫ •
ະఆٛγϯϘϧͷAnyܕͷϑΥʔϧόοΫ(consoleະఆٛ)
Structual(Subtyping struct Point {x :: Int, y :: Int} p
:: Point = {x: 1, y: 2, z: 3} n :: Int = p.z # type error p3d :: {x :: Int, y :: Int, z :: Int} = p # type error • ೖઌ͕αϒΫϥεͰ͋Δ͜ͱΛཁٻ͢Δ • ܕΞϊςʔγϣϯ͕એݴ͞ΕͨγϯϘϧ(ม)Ҏ߱ͦͷΠϯλ ʔϑΣʔεͰৼΔ͏
൵؍తܕਪ • ͯ͢ͷࣜimplicitଐੑͩͱԾఆ͢Δ • implicitଐੑಉ࢜ͰܕਪΛࢼΈࣦͯഊͨ͠߹" implicitଐੑͷAnyܕʹϑΥʔϧόοΫ͢Δ • Ϣʔβʔ͕ΞϊςʔγϣϯΛهड़ͨࣜ͠ඇimplicitଐੑ • ඇimplicitଐੑ͕ؔΘͬͯܕਪ͕ࣦഊͨ͠߹ɺΤϥʔͱ
ͳΔ
ͦͷଞͷػೳ • array • nullable • class͔ࣜΒͷߏମࣗಈநग़ • generics(wip) •
TypeScript5importer(wip)
ͳͥ࡞͔ͬͨ • CoffeeScriptͰϥΠϒϥϦΛࢼͭͭ͠ϓϩτλΠϓΛ࡞Γ·͘Δ • ݎ࿚ͳઃܭΛࢦ͢ͱΓܕ͕΄͘͠ͳΔ • TypeScriptͰॻ͖ͳ͓͢ͱܕఆٛΛॻ͍ͯҰ͕ऴΘΔ • CoffeeScriptͷତམͨ͠จ๏ͷ··Ͱɺܕ͕ͳ͍ঢ়ଶ͔Βɺஈ֊ తʹҠߦͰ͖ΔΑ͏ͳݴޠ͕΄͍͠ͳΝ…
ݱ࣮తͳधཁ • HTML5ΞϓϦέʔγϣϯͷڊେԽ • ͱ͘ʹγϯάϧϖʔδΞϓϦέʔγϣϯ(SPA)ͷधཁ • ֤͕ࣾେنCoffeeScriptͷϦιʔεΛ๊͑ͯΔͬΆ͍ • εʔύʔηοτͳίϯύΠϥஔ͖͑Ͱஈ֊తʹܕڥͷҠߦ
ओ؍ʹجͮ͘coffeeͱtypescriptͷൺֱ • CoffeeScriptͷϝϦοτ • ͔͍͍ͬ͜ • CoffeeScriptͷσϝϦοτ • ܕ͕ͳ͍ •
TypeScriptͷϝϦοτ • ܕ͕͋Δ
CoffeeScript+++TypeScript Զ͕ߟ͑ͨ࠷ڧͷAltJS
࠷ۙͷਐḿ • CoffeeScriptReduxͷsuper࣮ • TypeScriptͷܕఆٛϑΝΠϧͷύʔαΛ࡞ͬͨ(mizchi/dts8 parser) • ↑ʹରԠ͢ΔͨΊʹ෦ASTΛ΄΅θϩ͔Βॻ͖ͨ͠
ݱࡏͷϓϩδΣΫτͷ՝ • झຯ࣌ؒͰ࡞Δʹ։ൃ͔͔࣌ؒΓ͗͢ • ΫϥυϑΝϯσΟϯάͰ͖ͳ͍͔ߟҊத • ύτϩϯืूதɻͷͷϞνϕʔγϣϯΛۚͰങ͍·ͤΜ ͔?#$>#اۀ༷ • ʮΔؾʯ͕͋ͬͨΒSublimeText/VimͷΠϯςϦηϯε͙Β͍
·Ͱ࡞ΕΔ͔Ͷ??? • ֎ਓ͔Β͍Ζ͍Ζཁ͕͘Δ
ྺ࢙ • ࡢ8݄:$jashkenas/coffeescript$ͷίʔυಡΈ࢝ΊΔ • ࡢ10݄:$ϩϯυϯग़ுதͷඈߦػͷதͰϓϩτλΠϓΛ࡞Δ • ࡢ12݄:$ܕਪΛҰ௨Γ࡞Δ • ࠓ1~3݄:$ଔ͗͢͠ϫϩλ •
ࠓ5݄:$altjsಆձͰcoffeeҎ֎ͷൃද͢Δʁ • ։ൃ࠶։͢Δ͔ʂ
ઃܭࢦ • ܕΞϊςʔγϣϯߏจΛՃ • ੩తղੳ • ίϯύΠϥʹۃྗखΛೖΕͳ͍(Ϛʔδ͕ࠔʹͳΔͨΊ) • ίϯύΠϥͱผʹAST'TraverserΛॻ͘ •
ϊʔυ͝ͱʹtypeAnnota2onΛղܾ͢ΔܕਪثΛ࡞Δ ઃܭํ:"ݎ࿚ͳઃܭ"<"طଘίʔυ͔ΒͷҠߦίετ࠷খԽ
ϚΠϧετʔϯ • v0.11 • return,,ׂೖ,,δΣωϦΫε,,super,ͷਪ • ΤϥʔϨϙʔτͷվળ • v0.12 •
module • typealias • typescript,d.ts,importer
͓ΘΓ mizchi/TypedCoffeeScript!͋ͳͨͷ ߩݙΛ͍ͬͯ·͢ʂ
More Decks by Koutarou Chikuba
See All by Koutarou Chikuba
技術記事、 専門家としてのプログラマ、 言語化
mizchi
16
8.9k
CI/CD 改善の勘所
mizchi
0
300
極限環境で最終ビルドを絞るためのフロントエンド設計
mizchi
16
6.4k
Server Side JavaScript のためのバンドル最適化
mizchi
5
8.1k
V8 as a container on CDN Edge worker
mizchi
6
2.7k
Edge Side Frontend という新領域
mizchi
35
15k
バンドル最適化マニアクス at tfconf
mizchi
8
4.8k
「たかがJavaScript」のその先 #TECHPLAY
mizchi
47
21k
Deno Node 両刀
mizchi
7
2.7k
Other Decks in Technology
See All in Technology
常時稼働エージェントの作り方(Claude公式ブログを資料化)
minorun365
PRO
17
28k
Amazon Bedrock AgentCore の基礎とセキュリティ・ガバナンス
ren8k
0
200
DevOps Agentにあらゆるセキュリティインシデントのトリアージを任せた件
jirtosterone
1
190
専門家に使ってもらうAIプロダクトをつくる - 病院の医事課向けDPCコーディング支援システムの設計と評価
hagino3000
4
950
コピーオンライト型ファイルシステムと ランダム書き込み
sat
PRO
2
130
現地速報! Microsoft Ignite アップデートレポート
kasada
0
320
CloudTrail を推したい
kazzpapa3
1
150
閉域網でのAPI公開の選択肢全部比較!
takano0131
4
600
マネージャーをエスパーにしない マネジメントされる側から始める、働きやすい現場づくり
comi190327
1
830
_マネジメントする人される人ナイト_2026__良いチームを作っていきたい_お気持ち_.pdf
xkxaxkx
0
830
業務の傍らで進める改善ループエンジニアリング
bengo4com
1
220
Context parameters で作る!はじめての型クラス
kworkdev
PRO
1
160
Featured
See All Featured
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
360
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
360
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
980
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Done Done
chrislema
187
17k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
Code Reviewing Like a Champion
maltzj
529
40k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
480
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
640
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.7k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
670