-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reflect is not an appropriate place for Loader #76
Comments
My suggestion to @caridy was to expose it AS A MODULE since it's existence necessitates there being a public facing API for importing it. |
Admittedly I can see that suggestion as being a no-go due to the can of worms discussions it would likely lead to around built in modules. |
@domenic Gonna think about this for a few minutes but one question: do you feel |
No; sorry I didn't mention that. But yeah, same arguments:
|
@domenic Where would you propose the |
I don't really understand the scope of System, but it seems fine. Alternately the global seems fine. If there is concern it is too generic, then maybe it is called |
Can you explain why |
Because it is the global object. |
@domenic according to your philosophy, there should be a |
What? How does that follow from anything I've said? The global object is where host environments define their properties and extensions. See the ES spec:
|
|
@domenic I'm not trying to troll. I just want to understand why you think that web specs should never extend built-ins. |
Your quote is to allow ES implementations to add non-standard properties. It's not for the host environment, nor is it for standards. |
Let's put it this way. I don't think web specs should go add |
@domenic Ok, I think I got you now. 😄 You don't want the DOM to short-circuit discussions happening in TC39, with possible negative consequences if the extensions the DOM makes don't match (or cause confusion with) future versions of JS. Am I getting it now? |
Pretty much! Stated in those terms, in this case what we have is a web spec deciding unilaterally that Reflect is a place to put things that seem vaguely reflective, whereas TC39 has to-date flirted with that idea in mailing lists, but so far only put internal methods there. |
@domenic On first reading I missed what you said about WHATWG modifying builtins. I don't have a fully-formed opinion yet about where Loader involves a lot of cross-cutting interplay between the browser loading process, the extensibility mechanisms, and the core semantics of modules. This spec is serving as the frontier of work figuring out that interplay. As we go along, we're learning where the natural boundaries lie between generic ECMAScript behavior and browser-specific behavior. So while this work is happening in this repo, some of it should get uplifted back to ES and eventually removed from this spec. While it'd be nice to know in advance which stuff belongs in the web space, and which stuff belongs in this spec, we're learning where the boundaries lie as we go. I was talking with @annevk the other day -- recall he wrote the canonical "don't monkey-patch specs" blog post -- and he agreed that monkey-patching is actually a good way to describe initial proposals before proposing them for uplift in their proper spec. TL;DR because of cross-cutting concerns, it makes sense to do the work in one place and make sure the design is coherent, then ultimately take some of the material back to TC39 for absorption back in ECMAScript. But we shouldn't let the fact that it's happening here dictate API categorization. |
I never have the intention of doing anything unilaterally here. But I think concretely, what we should make sure to do is flag the stuff that affects ECMAScript proper and bring it to the attention of TC39. Why don't I schedule a topic at the next face-to-face to discuss the status of the Loader work and specifically highlight topics like this one? |
That sounds great, yeah :). |
@domenic @dherman @wycats I did some preliminary work on https://rawgit.com/caridy/ecmascript-loader/master/index.html (as discussed last week) to move
Let's try to get to consensus about this soon, so we can clean up the loader spec and focus on the missing features for milestone 0. |
I still disagree with putting these on Reflect. Regardless of what spec they live in, my second paragraph from the OP stands. If they are supposed to live in 262, a new global seems best. Sorry that I wasn't there on the last day to be part of these discussions. |
OK, so let's attack that then. :) I disagree! The idea that Put differently, you use pejoratives like "vaguely" and "dumping ground" to impute motives -- that I was careless and didn't really know where this stuff belonged. To the contrary, I deliberately chose
This is a strange logical implication. Earlier you were saying if they don't live in 262 they shouldn't be in I think the real point of contention here is about the granularity of standard library "modules." Right now, since things live on the global, there's a strong incentive towards small numbers of globals and consequently large modules. You and I both agree that the ideal is closer to substackianism. The question is really just one of our moment in time: we don't yet have a set of conventions for standard library naming and organization, or for how they interact with naming conventions in the ecosystem at large. Now, last week, @stefanpenner and @wycats said they're working on this and believe we can make some good headway. So ideally we can get to a point where we stop having these debates about how best to arrange deck chairs on the titanic But my opinion is that if we do get blocked:
|
Cool, let's go at it! :)
Right, but it is one that Reflect currently follows, and I personally would like to hold the line there. (I'm not committed to it, but it seems nice.)
Here's what I mean: why don't we put the Object and Array constructors there? They allow you to reflectively construct objects and exotic arrays! Why not Proxy? Why not anything? "Reflectively constructing" is more or less contentless, compared to just "constructing."
I'd like to see a stronger argument why all of this stuff is conceptually reflective, that doesn't just reduce to making the term reflective meaningless. Some links to definitions would probably help me. You might be right, but so far my experience with "reflection" in ES and in .NET does not include this realm of stuff (loading configuration or first-class namespace objects) at all.
I think there might be a disconnect here. As @littledan has mentioned a number of times, there's actually zero virtue in minimizing the number of globals. There's 730+ global constructors already. We're not going to stop this pattern. ES should embrace the patterns of the ecosystem it lives in, and not try to forge its own where it hides under namespace objects. So I think a couple more globals for module-related stuff seems fine.
To this and above comments about bureacracy, I really don't care about venue. The point I was trying to make earlier was about the separation between web specs and ES conceptually, not about who defines things. To me the loader has always been a "web spec": it's not suitable for all environments, etc. So from that perspective it shouldn't be messing with ES globals. Similar to how we say that Node environments shouldn't go adding things to Math or JSON or Reflect, but instead should use their own globals (Buffer or process or whatever). Maybe your thinking has evolved so that you think parts of the loader work are universally applicable to all environments, in which case that portion of my argument doesn't apply. But it was never about venue :) |
What makes it reflective is not that it's a runtime operation, but that it constructs something that interacts in non-trivial ways with elements of the base level semantics. The module system does not allow you to use arbitrary objects as modules. You can only use Similarly, the In short: the loader API is the hooking system by which user code can intercept and modify the behavior of the
From Wikipedia:
That's exactly what
I'm happy to entertain other organization of the standard library, but I'm just pretty bewildered that you think it's a stretch to call a dynamically user-hookable module system reflective.
That's at the very least an exaggeration. You're eliding a serious difference of scale. Nobody would be bragging if npm had 730 packages. We wouldn't splat all the SIMD constructors onto the window object (as opposed to under a single top-level SIMD object). That said, I wouldn't lose sleep over there being a grouping for module-related reflection, whether under a global Module.* grouping or Reflect.Module.*. I'm not sure if a global with a generic name like
This is really important to be clear about: from the beginning, this spec has contained a mix of web-specific stuff and stuff that is universal to ECMAScript. Put differently, TC39 didn't make a surgical cut when it moved stuff out from ES6 into WHATWG. In particular, the So we either have to allow for this spec to contain some elements that are universal to ECMAScript, or we have to move those parts back to TC39. To be clear, I am happy to move those parts back to TC39, and I plan to. I never had any intention of circumventing TC39 (I'm a member after all!). It was simply that TC39 decided to move that stuff to WHATWG, so that's what I did. But in retrospect, things like |
I don't think it's generally appropriate, or at least not good practice, for web specs (like whatwg/loader) to modify ES built-ins (like Reflect).
I also am generally against putting anything on Reflect that is not a JS representation of an object's internal method. Right now that is all that is there. Treating Reflect as a general dumping ground for stuff that feels vaguely related to reflection is wrong. And the loader isn't even related to reflection anyway, except by very stretched definitions.
System.Loader seems like a fine place to put the base system module loader class. Call it System.BaseLoader if you want.
The text was updated successfully, but these errors were encountered: