02:26 | <Mathieu Hofman> | Promise has the brand checks but no non-side-effect way to check it; and error sadly has no way to do the brand check, yes. Yet. |
02:34 | <Kris Kowal> | Yes, and my recommendation is that our stance should be to enable and help people to avoid releasing Zalgo, not prevent people from releasing Zalgo. The latter is not possible. The former is possible while still revealing a brand check. It’s not the same magnitude of hazard as, say, an API to synchronously query the state of a promise. |
04:31 | <bakkot> | Since we're talking about this stuff, reminder that https://github.com/tc39/proposal-faster-promise-adoption exists |
16:13 | <voide> | Hello everyone. I've been trying to understand https://tc39.es/ecma262/#sec-functiondeclarationinstantiation as applied to functions without parameters. Say I have the function:
Is a single Lexical Environment created for x,y,z or is z stored on the first LE and x,y on another one with Outer Environment set to the first LE...or something else I didn't think of? I'm excluding the VE because there's only 1 reference (20d) and it looks only related to either a strict function or a function with Parameter Expressions, but this function has no parameters at all. This is closely related to a StackOverflow question (this comment in particular) which unfortunately didn't get the answer needed. |
17:10 | <bakkot> | voide: it depends on whether the function is in a strict context or not. in a non-strict context, "z stored on the first LE and x,y on another one with Outer Environment set to the first LE" is accurate - see step 30/31. |
18:57 | <voide> | Thanks for confirming. Does this mean that:
refers to a new LE, not the first one? I feel like this is the missing puzzle piece for me. |
19:01 | <voide> | I suppose it's the the article that throws me off. |
19:01 | <jmdyck> | Not sure if this'll help but: in spec terms, there isn't a thing that is a Lexical Environment. Rather, LexicalEnvironment is simply the name of a component of an execution context. |
19:02 | <jmdyck> | So the Set step is setting a component of calleeContext . It's like calleeContext is a Record, and LexicalEnvironment is simply the name of one of its fields. |
19:04 | <voide> | Yes, this is something I understand now and I know we're talking about abstractions. Thing is, by the time that step is being executed there's already a Lexical Environment with a var declaration and that part confuses me a little. |
19:05 | <jmdyck> | The value of that component/field is an Environment Record. |
19:06 | <voide> | This:
Is language that is clear to me because you said it's a component instead of the component. |
19:07 | <jmdyck> | If I had a record _foo_ with a field [[Bar]] , I could say Set the [[Bar]] field of _foo_ to 0. |
19:08 | <jmdyck> | It wouldn't be correct to say Set a [[Bar]] field of _foo_ to 0. |
19:11 | <bakkot> | voide: you might find it useful to look at https://github.com/engine262/engine262/blob/3248ccc6793a4de3ca6cab1d3a16a113ddc8d0c9/src/runtime-semantics/FunctionDeclarationInstantiation.mjs#L237, which is a JS implementation of this algorithm |
19:12 | <voide> | If I had a record |
19:12 | <voide> | voide: you might find it useful to look at https://github.com/engine262/engine262/blob/3248ccc6793a4de3ca6cab1d3a16a113ddc8d0c9/src/runtime-semantics/FunctionDeclarationInstantiation.mjs#L237, which is a JS implementation of this algorithm |