domenic / promises-unwrapping

The ES6 promises spec, as per September 2013 TC39 meeting
1.23k stars 94 forks source link

`Call` is kind of hacky/poorly named #63

Closed domenic closed 10 years ago

domenic commented 10 years ago

I added Call because I had a lot of steps that were trying to call user functions that might throw an exception, and it was verbose to repeat those steps over and over.

It's not great though; it probably doesn't belong as a delta in the completion record section, at the very least.

I couldn't think of a more generic and useful abstraction for the spec, e.g. a parallel to Get, since what I really want is to ignore the return value unless it's an exception. So I should at the very least not squat on the name "Call."

Probably the best thing to do here is just suck it up and inline those lines?

I could also reduce the repetition a little bit by introducing a Call that parallels the other abstract ops, reducing

  1. Let result be the result of calling the [[Call]] internal method of function with undefined as thisArgument and a list containing argument as argumentsList.
  2. ReturnIfAbrupt(result).

to

  1. Let result be the result of calling Call(function, undefined, (argument)).
  2. ReturnIfAbrupt(result).

This would presumably be useful all over the spec.