Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Back to the future of JS
Search
Willian Martins
July 03, 2018
Technology
1
42
Back to the future of JS
This is an extended version of my talk I gave @ NodeJs Meetup in Berlin in July 2018
Willian Martins
July 03, 2018
Tweet
Share
More Decks by Willian Martins
See All by Willian Martins
Além do else! Categorizando Pokemóns com Pattern Matching no JavaScript
wmsbill
0
780
De volta ao Futuro do JS: As próximas features e propostas incríveis
wmsbill
0
60
Back to the future of JS II: Beyond what we can foresee
wmsbill
0
78
A, B, C. 1, 2, 3. Iterables you and me.
wmsbill
0
67
Back to the future of JS II: Beyond what we can foresee
wmsbill
0
76
Back to the future of JS.
wmsbill
0
11
Node conf ar 2018.
wmsbill
0
360
Back to the future of JS
wmsbill
2
240
WebAssembly in NodeJS
wmsbill
4
540
Other Decks in Technology
See All in Technology
LayerXとMDMのリスク評価と年次対応の実例(公開版)
ken5scal
0
400
自分の学習データで画像生成AIを使ってみる話
moyashi
2
160
Amazon FSx for Net App ONTAPにおけるファイルシステム/SVM/ボリューム/qtreeの分割の考え方を整理してみる #storagejaws
non97
1
340
Developing image pull secrets provisioner / Kubernetes Meetup Tokyo #65
pfn
PRO
2
280
ドラッグストア店員が 独学で化粧品顧客管理アプリを作成した話
mierune
PRO
1
260
株式会社EventHub・エンジニア採用資料
eventhub
0
2.3k
Autonomous Database サービス・アップデート (FY24)
oracle4engineer
PRO
2
700
入門 電気通信事業者
kurochan
10
4.4k
EKSと動的プロビショニングEFSを使ったマルチリージョンDR
daitak
0
200
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
5
39k
AWS Control Towerと HashiCorp Terraformでいい感じにマルチアカウント管理をしよう
chazuke4649
0
420
『VoLT』レバテックの デザインシステム ~電光石火の構築プロセスと目指す未来~
leveragestech
2
110
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
261
12k
Code Reviewing Like a Champion
maltzj
516
39k
StorybookのUI Testing Handbookを読んだ
zakiyama
14
4.8k
Why Our Code Smells
bkeepers
PRO
331
56k
A designer walks into a library…
pauljervisheath
201
23k
Done Done
chrislema
178
15k
Practical Orchestrator
shlominoach
184
9.8k
10 Git Anti Patterns You Should be Aware of
lemiorhan
650
58k
GraphQLの誤解/rethinking-graphql
sonatard
57
9.4k
Making Projects Easy
brettharned
110
5.6k
A Modern Web Designer's Workflow
chriscoyier
689
190k
VelocityConf: Rendering Performance Case Studies
addyosmani
321
23k
Transcript
Hallo!
https://github.com/tc39/proposals
NodeJs Meetup
@wmsbill What is this?
@wmsbill this in the global scope Browser - window Web
worker - self NodeJS - module.exports
@wmsbill this inside a function?
@wmsbill this inside a function?
None
@wmsbill How to make this predictable? Reasoning the value of
this is tricky Function.prototype.bind Arrow function () => {}
With .bind()
With Arrow
@wmsbill Calling a knowing function
@wmsbill Extracting a method from an object
None
@wmsbill Two syntaxes Unary : :context.method() Binary context: :method()
@wmsbill Binary syntax
@wmsbill Unary syntax
@wmsbill
@wmsbill
@wmsbill
@wmsbill Bind operator is good for virtual methods But relies
on this to be bound
@wmsbill Composing without this
@wmsbill
@wmsbill
None
@wmsbill Pipeline operator |> It is a syntax sugar for
function composition It creates a way to streamline a chain of functions
@wmsbill Pipeline operator |>
@wmsbill
@wmsbill
@wmsbill
@wmsbill Function with more params
@wmsbill Function with more params
@wmsbill Awaiting a function
@wmsbill Awaiting a function
@wmsbill Awaiting a function
@wmsbill Awaiting a function
@wmsbill Awaiting a function
None
@wmsbill Smart pipeline
@wmsbill Smart pipeline Two types bare style and topic style
() or [] are disallowed in bare style When () or [] is needed, topic style is used # token is subject to change
@wmsbill What about curry?
None
@wmsbill F# pipeline proposal Extends the minimal proposal with an
await step Await step waits for the resolution of the previous step
@wmsbill F# pipeline proposal
@wmsbill
@wmsbill Partial application f(…) arity = n; partialapp(f(…)) arity =
m; m < n
@wmsbill
@wmsbill
@wmsbill Partial application in ES Achievable by Function.prototype.bind .bind() binds
context and parameters
@wmsbill
@wmsbill What about currying? We can achieve partial application with
curry Curry ≠ Partial application Curry returns arity n-1
@wmsbill
@wmsbill Partial application with arrow function
None
@wmsbill Partial application proposal Creates two new parameters tokens ?
For single argument . . . for multiple parameters
@wmsbill Partial application syntax
@wmsbill With arbitrary parameter
None
@wmsbill The . . . token Spread the unbound parameters
Useful when you want to bound first or last parameter
@wmsbill The . . . token
@wmsbill The . . . token
None
@wmsbill Partial application + pipeline
@wmsbill Partial application + pipeline
@wmsbill Should I use all of it in production? These
proposal are in very early stage The adoption of one, may change the syntax/semantics of other Not production ready (yet)
@wmsbill Let’s talk about something more solid?
None
@wmsbill [].flatMap syntax
@wmsbill [].flatMap syntax
[].flatMap x [].map
@wmsbill [].flatMap x [].map [].map guarantees the same array size
based on input [].flatMap doesn’t guarantees same array length as input array It could be used as filtering
@wmsbill [].flatMap as filter
@wmsbill #smooshgate
@wmsbill [].flatten
@wmsbill [].flatten syntax
@wmsbill [].flatten syntax
@wmsbill [].flatten syntax
@wmsbill So what is the deal?
MooTools
@wmsbill #smooshgate MooTools is an 11 years old ancient lib
They implemented [].flatten with different behavior The implementation + Elements Enhanced HTML component breaks the compatibility w/ [].flatten
https://youtu.be/loqVnZywmvw
@wmsbill TC39 had two options Change flatten to another name
(like smoosh) Break the internet
Array.prototype.flatten
Array.prototype.flatten
https://medium.com/@wmsbill https://twitter.com/wmsbill
[email protected]
Dankeshön!