ecma262 icon indicating copy to clipboard operation
ecma262 copied to clipboard

Editorial: describe behavior for algorithms without a "Return"

Open bakkot opened this issue 3 years ago • 7 comments

Fixes #2394.

bakkot avatar Apr 29 '21 00:04 bakkot

I note that this races with two new usages of Return. in https://github.com/tc39/ecma262/pull/1668, and whichever lands second will need to be rebased. I'm happy to do that myself, I'm just commenting so we don't lose track.

bakkot avatar Apr 29 '21 20:04 bakkot

Thinking about this more, we could instead use a new kind of completion record here (just for procedure early exits) that doesn't have a [[Value]] slot, making the attempt to use the value of an AO that returns it an editorial type error through existing means.

michaelficarra avatar Apr 29 '21 21:04 michaelficarra

I would prefer not to further complicate the distinction between normal and abrupt completions, I think.

bakkot avatar Apr 29 '21 21:04 bakkot

Yeah, I think I agree. We might be able to make some improvements in this area once completion value reform is complete.

michaelficarra avatar Apr 29 '21 21:04 michaelficarra

This should wait on https://github.com/tc39/ecma262/pull/2413 / https://github.com/tc39/ecma262/pull/2429, which touch several of the same places.

bakkot avatar Jun 11 '21 18:06 bakkot

I think, once PR #2547 lands, you won't need this PR any more, because there won't be any algorithms that complete without a Return.

Or I suppose you could say that if it happens it's an editorial error.

jmdyck avatar Feb 10 '22 01:02 jmdyck

If you rebase to main (now that #2547 has landed), I think you'll find that there isn't much left in this PR.

Note that 9.10.3 Execution doesn't have a "Return" step, so you might want to add a Return ~unused~. On the other hand, it's a weird case, so maybe "Return" doesn't mean anything?

jmdyck avatar Mar 10 '22 15:03 jmdyck

Fixed by #2547 instead.

bakkot avatar Feb 15 '23 23:02 bakkot