ecma262 icon indicating copy to clipboard operation
ecma262 copied to clipboard

Macros which affect control flow should be visible at callsite

Open bakkot opened this issue 3 years ago • 10 comments

IfAbruptRejectPromise is used like a macro, but it returns from the caller in one of its branches. (IfAbruptCloseIterator in https://github.com/tc39/ecma262/pull/2113 will have the same problem.) That's confusing for readers.

We should distinguish these calls somehow. Maybe they could be kebab-case, so they don't look like AO invocations?

bakkot avatar Aug 25 '21 22:08 bakkot

I'm also partial to rust's macro! syntax, though @michaelficarra said he'd prefer something without a new sigil.

bakkot avatar Aug 25 '21 22:08 bakkot

Is there a reason you're calling out those two specifically? ReturnIfAbrupt has the same behavior for example.

devsnek avatar Aug 25 '21 22:08 devsnek

ReturnIfAbrupt has the same issue, yes.

bakkot avatar Aug 25 '21 22:08 bakkot

I'm partial to special prose forms like we do with substrings.

michaelficarra avatar Aug 25 '21 22:08 michaelficarra

@michaelficarra do you have a prose form in mind for, e.g., IfAbruptRejectPromise?

bakkot avatar Aug 25 '21 23:08 bakkot

"Perform the expansion of", maybe?

syg avatar Aug 26 '21 00:08 syg

@syg I like the idea of a special form for macro application, though I was referring to per-macro special forms above. So for IfAbruptRejectPromise, something like Account for abruptness of _value_ with rejection of _capability_..

michaelficarra avatar Aug 26 '21 00:08 michaelficarra

Oh I see, you were thinking of the thing HTML does. I'm fine with either ! or special prose forms so long as it's all autolinked, which I'm sure it will be. The auto-linking of special prose forms will be more finicky, though.

syg avatar Aug 26 '21 00:08 syg