tc39 / proposal-import-attributes

Proposal for syntax to import ES modules with assertions
https://tc39.es/proposal-import-attributes/
Apache License 2.0
599 stars 26 forks source link

Decouple JSON module from this proposal #86

Closed xtuc closed 4 years ago

xtuc commented 4 years ago

As discussed during the last TC39 meeting

dandclark commented 4 years ago

I wonder whether or not it makes sense to also decouple the HTML spec integration PR. If Import Conditions Assertions advances before JSON modules, I think that HTML could still technically go ahead and implement JSON modules without being in violation of the spec. The JSON modules proposal would only restrict what a host can do with assert { type: "json" }, but HTML could run ahead and implement them before that. Where we'd run into trouble is if TC39 makes a different decision about whether to freeze the JSON object, HTML could suddenly find itself in violation.

I propose this course of action: Keep the HTML spec integration combined for now. If Import Assertions and JSON modules end up advancing to Stage 3-4 in lockstep, then we'll land their combined HTML spec integration together. If however Import Assertions pulls ahead of JSON modules in stage advancement, we should revisit splitting the HTML spec PR.

ljharb commented 4 years ago

could run ahead and implement them before that.

I suspect that's the worst fear of splitting out the proposals - if there's a hint that could happen, then this proposal should not advance beyond JSON modules, for that exact reason. JSON modules must not be implemented anywhere until TC39 has consensus on their semantics, or else TC39 will be unable to standardize them.

littledan commented 4 years ago

I'm not sure why @ljharb 's post is written in the third person, given that he was the one to raise this concern. We should be able to talk everything through directly, and I disagree that hinting at things is grounds for rejecting a proposal.

Anyway, I don't see a reason why we need to rush JSON modules. The idea here is that we would have a Stage 2 TC39 proposal for JSON modules which we would point to directly from the README here. I think this would be sufficient to coordinate across environments to ask them to wait for the cross-environment definition, to avoid the risk of divergence. This would mean we agree to not pursue JSON modules in HTML, but it would be fine to pursue other environment-specific module types there.

Jack-Works commented 4 years ago

I saw the idea of let JSON module exports Record & Tuples instead of objects in the meeting notes. I like this idea! Is there any place I can track this idea going on?

ljharb commented 4 years ago

@littledan i did not get the impression i was the only one with the concern, but sure, fair enough. I absolutely would not support this proposal moving to stage 3 if I had the impression that any widely used engines were planning to ship JSON modules prior to it reaching stage 3, and I'll stand by that.

That said, I think it's quite achievable to coordinate with the browsers and node to ensure that that doesn't happen. Other module types that TC39 has no intentions to standardize are fine with me.

littledan commented 4 years ago

@ljharb You're right; many of us (including me!) are really interested in ensuring we have cross-ecosystem alignment here. I share the optimism that this is achievable through a TC39 proposal for JSON modules and coordinating to hold off on environment-specific JSON modules.