Slide 1

Slide 1 text

Hallo!

Slide 2

Slide 2 text

https://github.com/tc39/proposals

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

@wmsbill What is this?

Slide 5

Slide 5 text

@wmsbill this in the global scope Browser - window Web worker - self NodeJS - module.exports

Slide 6

Slide 6 text

@wmsbill this inside a function?

Slide 7

Slide 7 text

@wmsbill this inside a function?

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

@wmsbill How to make this predictable? Reasoning the value of this is tricky Function.prototype.bind Arrow function () => {}

Slide 10

Slide 10 text

With .bind()

Slide 11

Slide 11 text

With Arrow

Slide 12

Slide 12 text

@wmsbill Calling a knowing function

Slide 13

Slide 13 text

@wmsbill Extracting a method from an object

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

@wmsbill Two syntaxes Unary : :context.method() Binary context: :method()

Slide 16

Slide 16 text

@wmsbill Binary syntax

Slide 17

Slide 17 text

@wmsbill Unary syntax

Slide 18

Slide 18 text

@wmsbill

Slide 19

Slide 19 text

@wmsbill

Slide 20

Slide 20 text

@wmsbill

Slide 21

Slide 21 text

@wmsbill Bind operator is good for virtual methods But relies on this to be bound

Slide 22

Slide 22 text

@wmsbill Composing without this

Slide 23

Slide 23 text

@wmsbill

Slide 24

Slide 24 text

@wmsbill

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

@wmsbill Pipeline operator |> It is a syntax sugar for function composition It creates a way to streamline a chain of functions

Slide 27

Slide 27 text

@wmsbill Pipeline operator |>

Slide 28

Slide 28 text

@wmsbill

Slide 29

Slide 29 text

@wmsbill

Slide 30

Slide 30 text

@wmsbill

Slide 31

Slide 31 text

@wmsbill Function with more params

Slide 32

Slide 32 text

@wmsbill Function with more params

Slide 33

Slide 33 text

@wmsbill Awaiting a function

Slide 34

Slide 34 text

@wmsbill Awaiting a function

Slide 35

Slide 35 text

@wmsbill Awaiting a function

Slide 36

Slide 36 text

@wmsbill Awaiting a function

Slide 37

Slide 37 text

@wmsbill Awaiting a function

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

@wmsbill Smart pipeline

Slide 40

Slide 40 text

@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

Slide 41

Slide 41 text

@wmsbill What about curry?

Slide 42

Slide 42 text

@wmsbill F# pipeline proposal Extends the minimal proposal with an await step Await step waits for the resolution of the previous step

Slide 43

Slide 43 text

@wmsbill F# pipeline proposal

Slide 44

Slide 44 text

@wmsbill

Slide 45

Slide 45 text

@wmsbill Partial application f(…) arity = n; partialapp(f(…)) arity = m; m < n

Slide 46

Slide 46 text

@wmsbill

Slide 47

Slide 47 text

@wmsbill

Slide 48

Slide 48 text

@wmsbill Partial application in ES Achievable by Function.prototype.bind .bind() binds context and parameters

Slide 49

Slide 49 text

@wmsbill

Slide 50

Slide 50 text

@wmsbill What about currying? We can achieve partial application with curry Curry ≠ Partial application Curry returns arity n-1

Slide 51

Slide 51 text

@wmsbill

Slide 52

Slide 52 text

@wmsbill Partial application with arrow function

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

@wmsbill Partial application proposal Creates two new parameters tokens ? For single argument . . . for multiple parameters

Slide 55

Slide 55 text

@wmsbill Partial application syntax

Slide 56

Slide 56 text

@wmsbill With arbitrary parameter

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

@wmsbill The . . . token Spread the unbound parameters Useful when you want to bound first or last parameter

Slide 59

Slide 59 text

@wmsbill The . . . token

Slide 60

Slide 60 text

@wmsbill The . . . token

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

@wmsbill Partial application + pipeline

Slide 63

Slide 63 text

@wmsbill Partial application + pipeline

Slide 64

Slide 64 text

@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)

Slide 65

Slide 65 text

https://medium.com/@wmsbill https://twitter.com/wmsbill [email protected]

Slide 66

Slide 66 text

Dankeshön!