Correction, suppose const b = { a : b } . Circular references can be cloned
trivially, as far as I can tellOn Tue, 23 Oct 2018 at 20:52 Naveen Chawla <[email protected]> wrote: > Is there any real problem with circular reference cloning? I don't see > any, Please let me know in the simplest case e.g. { a: a } (obviously > contrived syntax here) > > Otherwise, I agree completely about the 4 dots being the wrong syntax for > this, precisely for the reason you gave > > On Tue, 23 Oct 2018 at 18:18 Henrique Barcelos <[email protected]> > wrote: > >> IMO, this would be very problematic. >> >> 1. 4 dots are visually almost identical to 3 dots. This could introduce >> severe bugs because of a simple hard to spot typo. >> >> 2. Deep traversing will always have performance problems in some cases. >> Dealing with circular references can take this issue even further. >> >> I believe such functionality should be used in very specific situations, >> where object shape is well-known, not very deep and definitely not >> circular. So, supporting this at the core of the language will probably be >> frowned upon by the community. >> >> Em ter, 23 de out de 2018 08:57, Ahad Cove <[email protected]> escreveu: >> >>> Hello Scripters, >>> >>> I really appreciate everything you all have done for the language and >>> have no complaints over here. >>> I do have a suggestion though :) >>> >>> At work we’ve almost got rid of lodash, except we still need it for >>> DeepCopy vs rolling our own. >>> It’s the same with my side projects. I don’t use lodash because the main >>> times that I need deep copy is when I’m either digging into the Redux store >>> using React, or copying an observable in the Angular world. >>> >>> I believe ES Script users would appreciate having a deep copy spread >>> operator tremendously. >>> >>> My proposal is to go off of the current spread operator we currently >>> have in ES and make it 4 dots for a deep spread. This can be used on >>> Objects or Arrays. >>> >>> ‘’’js >>> const oldDeepObj = { >>> InnerObj: { >>> func: () => return ‘wow’ >>> } >>> } >>> >>> const obj = {....oldDeepObj} >>> obj.innerObj.func = () => return ‘nice’ >>> >>> oldDeepObj.innerObj.func() >>> > wow >>> ‘’’ >>> >>> Thank you! >>> Looking forward to hearing back from you all. >>> If there’s any other questions let me know >>> >>> - Bilal Abdullah >>> _______________________________________________ >>> es-discuss mailing list >>> [email protected] >>> https://mail.mozilla.org/listinfo/es-discuss >>> >> -- >> >> Henrique >> _______________________________________________ >> es-discuss mailing list >> [email protected] >> https://mail.mozilla.org/listinfo/es-discuss >> >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

