Code Monkey home page Code Monkey logo

Comments (6)

erights avatar erights commented on August 17, 2024 1

No, because Object.isFrozen is not transitive. If def stopped at a frozen object, it could miss non-frozen objects that were reachable from named properties of that frozen object:

const bad = Object.freeze([{}]);
// At this point, we have a frozen array containing 
// a non-frozen object in its transitive API surface.
def(bad);

If the call to def succeeds, then the transitive API surface starting at bad must be frozen. But an isFrozen check would stop too early.

from endo.

erights avatar erights commented on August 17, 2024 1

Noting again here that we're likely to change terminology from "deeply frozen" and such to "hardened".

from endo.

kumavis avatar kumavis commented on August 17, 2024

can you use Object.isFrozen(obj)

from endo.

erights avatar erights commented on August 17, 2024

In addition to labeling this an "enhancement" I also label it a "bug" because it is a huge performance bug. Normally, if there is no deviation from correct overt behavior I avoid "bug". But the performance shortfall here is huge.

from endo.

dckc avatar dckc commented on August 17, 2024

This weakmap seems to be global mutable state. Why is that ok in this case?

Also, is it shared between realms? Between calls to require('harden')?

from endo.

warner avatar warner commented on August 17, 2024

This weakmap seems to be global mutable state. Why is that ok in this case?

Also, is it shared between realms? Between calls to require('harden')?

I'm going to open a separate issue to discuss this, I think we have an answer but I don't want to lose visibility when I close this as fixed in a few minutes.

from endo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.