-
Notifications
You must be signed in to change notification settings - Fork 0
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
audit builtins to confirm effect of stabilization #6
Comments
This new level is designed to imply (and be a proper superset of) frozenness, and its additional behavior takes the form of stricter constraints. But all of those behaviors apply to frozenness, and so really aren't even in scope for a strengthening thereof IMO. If anyone needs something like a frozen or stabilized but still dynamic RegExp instance, then it is incumbent upon them to define the appropriate proxy (or use a library that does so). Fixing that to be more ergonomic would be great, and I'd be willing to help champion that, but this is just not the proposal for it. |
That's fine, but I'd still like to see a thorough list of builtins and the implications of being stabilized vs frozen. |
Well, that's easy: because no built-ins are proxies, the only observable difference between using the functionality in this proposal vs. using In short, there are no specific implications for built-ins, because this proposal does not interact with exotic behaviors other than those associated with proxies. |
Fair enough. I do think that it might actually be in scope of this proposal, however, to consider improvements to behavior vs being frozen, given that there's a web compatibility risk to improvements for frozen objects, but no such risk for stabilized objects. In other words, once this proposal ships, the risk-free window of making such improvements has closed. |
Sure, do you have any other specific suggestions? I appreciate the ones in this report (relating to RegExp instance |
Well that's not entirely correct. The idea for stabilize is that any exotic behavior cannot be observable to the JS program. Proxies is just the way to make exotic behavior programmable, and this observable, but some built-ins could make it observable too. There is one concrete case where stabilize needs to be handled by the built-in: the deferred module namespace object (proposal). Accessing any property of that object will trigger evaluation of user code, something that stabilize doesn't allow. The behavior for the built-in needs to either refuse stabilization until evaluation, or trigger evaluation on stabilization. I believe no other built-in exposes such observable behavior, however host objects could technically have this behavior too, and would need to be audited and a similar way to handle the case decided if applicable. |
I don't yet, which is why I was asking for an audit :-) Certainly if your position is going to be that stablized things shouldn't have any behavior frozen things don't then there's nothing to improve, but I don't think that's a coherent position to hold when the two "mistakes" being fixed by stabilize are both behaviors unchanged by freezing. |
It's not that they don't have any behavior beyond frozenness, it's that any new behavior is stricter/more constrained ("frozen but moreso").
Explaining why it is coherent:
|
That position basically ensures that any places where freezing makes an object useless in a context, stabilize can't make it less useless, which seems like a huge lost opportunity. |
💯
That's just not the point of this proposal. It would be far worse IMO to have a new integrity level that is more restrictive in some ways and less restrictive in others, rendering it incapable of satisfying the reason for existing in the first place. But as I mentioned above, I'm happy to work with you or anyone else on addressing such situations (objects made useless by freeze) at their source. |
Right - but that work is highly likely to have web compat risk for frozen things, and thus be unable to improve anything for freeze. The point of freezing isn't to make these things useless, it's to prevent the structure from changing, and the point of stabilize as i understand it is to do what freezing "should have done" in the first place - so I'm not sure why it's a requirement that it be more restricting than freezing, as long as it doesn't violate the needs of SES. |
For correcting this misunderstanding, I direct you to the README: «extending the existing system of integrity "levels"… mitigating • The assignment-override-mistake • The return-override-mistake • Proxy reentrancy hazards».
That's covered in Background: «These are "levels" because they are currently in a fully-ordered hierarchy: All frozen objects are sealed, and all sealed objects are non-extensible». |
I understand that that's how this proposal has positioned itself, but that's not the underlying motivation as I understand it. |
For example, regexes - this is already a problem with frozen ones (
Object.freeze(/a/g).exec('')
throws), but is there a reason that stabilized regexes couldn't do something different, like keep the lastIndex in a slot or something?Also, arrays - say if you have an array subclass (not that we should care about subclasses) that produces a frozen or stabilized array,
SubArray.from
andSubArray.of
will throw, as willsubarray.concat
, and a number of others.A stabilized Promise, Map, Set, etc will still be mutable.
All of the implied behaviors might be perfectly fine! but it'd be helpful to have a complete list in case there's an opportunity to do something different.
The text was updated successfully, but these errors were encountered: