Partial Application

Proposal: https://github.com/tc39/proposal-partial-application

Scope: identify to what degree the garden path problem is an issue for developers. Areas for testing are functions and templates.

Discussion: https://github.com/tc39/notes/blob/9f97eda2327bbbf83dd748af08eb09ac2fcd4d6d/meetings/2018-07/july-25.md#partial-application

Partial application introduces ? as a placeholder for creating partially applied functions. There are a couple of issues raised in the discussions. What we want to test here is the garden path problem raised in the discussion. The main area this might be an issue is in templates.

Problem cases:
Problem 1: The garden path

const a = foo(
  a,
  b,
  c,
  ?
)

What is a? the result of foo? a partial function? What would people see, and would they miss a bug here?

Problem 2: multiple partially applied functions

const a = foo(?, bar, ?)

How would people expect this to work? would you call a(b, c), or x = a(b) followed by y = x(c)?

Problem 3: Nested partially applied functions

const a = foo(double(?), bar)

what is the first argument passed to foo? In this case it is a partially applied function, however people may expect foo to be a partially applied function. How problematic will this be?

A counter proposal:

1 Like