Code Monkey home page Code Monkey logo

Comments (8)

kfranqueiro avatar kfranqueiro commented on August 28, 2024

Darnit. So you're saying #45's idea has a hole? Is there something we can do instead that doesn't go back to the previous problem of having to think of every thing we want to exclude?

Also, does the fact that lang's isObject is only for internal use for determining whether to recurse when deep copying make this any less critical? (I'm guessing not, since any object that gets passed in could be susceptible to this.)

from core.

kitsonk avatar kitsonk commented on August 28, 2024

Do we maybe have an ES6 has branch? Something that detects Symbols and
traverses the Prototype chain? I suspect there is a logic that doesn't
waste too many cycles on edge cases.
On Thu, 13 Aug 2015 at 23:42, Kenneth G. Franqueiro <
[email protected]> wrote:

Darnit. So you're saying #45 #45
idea has a hole? Is there something we can do instead that doesn't go back
to the previous problem of having to think of every thing we want to
exclude?

Also, does the fact that lang's isObject is only for internal use for
determining whether to recurse when deep copying make this any less
critical? (I'm guessing not, since any object that gets passed in could be
susceptible to this.)


Reply to this email directly or view it on GitHub
#62 (comment).

from core.

devpaul avatar devpaul commented on August 28, 2024

I ran into a similar curiosity when writing dojo/array. The spec suggested using a wrapper for length = Number(length) to support array-like objects. It ended up forcing incorrect array-like implementations (e.g. length = Infinity) into sensible things (e.g. 0). Values that were already numbers were just passed through.

In a similar manner, if we're targeting ES5+ we should be able to use:

function isObject(obj) {
    return obj === Object(obj);
}

If it's truly an object Object() will pass it through. Otherwise it will wrap it and fail the conditional.

from core.

kfranqueiro avatar kfranqueiro commented on August 28, 2024

I do not understand why #63 was merged. AFAICT my last comment there stands (where this completely regresses previous behavior where e.g. Dates and RegExps would not receive this treatment, which was pretty much the entire point of what was previously there).

See #45 for the original context.

from core.

kitsonk avatar kitsonk commented on August 28, 2024

Apologies... I read the first part of the comment and not the second part:

More importantly, the implementation on this branch currently doesn't filter what we need it to, either (e.g. Date objects would return true, but should not be deep copied).

It is getting a bit silly though that we can't sort patches like this in 5 months. We really need to try harder.

from core.

kfranqueiro avatar kfranqueiro commented on August 28, 2024

It is getting a bit silly though that we can't sort patches like this in 5 months. We really need to try harder.

If time were an unlimited resource...

My opinion on the matter at the time was "I'm not really worried about the symbols case, and what's there already works otherwise, so I'd just as soon not land this unless we can come up with something better", and my and others' attention were focused on other things, so I didn't see that particular PR as pressing.

from core.

kitsonk avatar kitsonk commented on August 28, 2024

If time were an unlimited resource...

Yup, five months is a really constrained resource. Gotcha.

from core.

bryanforbes avatar bryanforbes commented on August 28, 2024

4869ea9 should be backed out. The following code is now producing strange results:

a = { a: /asdf/ };
b = { a: /qwer/ };
lang.deepMixin(a, b);

a.a === b.a // false
a.a // {}

Additionally, I don't think we should worry about the case of someone changing an object's Symbol.toStringTag, so this issue becomes moot and the original code is fine. We should, however, make our tests for deepAssign and deepMixin more robust.

from core.

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.