Path: csiph.com!feeder.erje.net!2.eu.feeder.erje.net!news.roellig-ltd.de!news.mb-net.net!open-news-network.org!.POSTED.35.233.197.178.dynamic.wless.lssmb00p-cgnat.res.cust.swisscom.ch!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Recording changes to an object Date: Thu, 05 Jul 2018 09:25:35 +0200 Organization: PointedEars Software (PES) Lines: 34 Message-ID: <11101754.O9o76ZdvQC@PointedEars.de> References: <1620852.VI2in3QvqR@PointedEars.de> <1903c1d9-646d-4518-b566-04c17a4f4a9d@googlegroups.com> <4080171.LvFx2qVVIh@PointedEars.de> <1829355.oMNUckLgyt@PointedEars.de> <88daeb31-72d6-49b3-8140-8398710cb13c@googlegroups.com> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit Injection-Info: gwaiyur.mb-net.net; posting-host="35.233.197.178.dynamic.wless.lssmb00p-cgnat.res.cust.swisscom.ch:178.197.233.35"; logging-data="3555"; mail-complaints-to="abuse@open-news-network.org" User-Agent: KNode/4.14.2 Cancel-Lock: sha1:TNl6FKvU3rpu3U62jpqPeLGl3Ck= X-User-ID: U2FsdGVkX1+nXgvdt7iEfmevlHuvPXg4RwnxYp10eWiy66ToZIKrHQ== X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. Thomas 'PointedEars' Lahn wrote: >> Michael Haufe (TNO) wrote: >> > as a minimalist I ask, why bother having both? The instance method >> > seems to be the minimal requirement if you're not introducing new >> > syntax >> I did not say “both”. Also, that is not what you were arguing. > > You were using JSON.stringify() as an analogy, which implied to me that > you were advocating for an Object.clone(instance) method that potentially > calls instance.clone(), It was not implied, but was in my stub code explicitly. UTSL. > and my response is why bother with the static one > at all? What would that give you? It wouldn't have privileged access to > the internals of the target. I don't see how Object.prototype.clone() > could just be "syntactic sugar". Again, that is _not_ what you argued before. However, as should be obvious from my stub code, having both the static method and the dynamic one [again, I did _not_ advocate for *both* *built-in* *Object*.prototype.clone() *and* Object.clone()] has the advantage that custom cloning behavior MAY easily be specified for an object without rewriting the caller code, for example to handle the special object state that you were talking about. Think of it like the possibility of overloading a (“clone”) operator (which is what I actually do in JSX:math). -- PointedEars FAQ: | | Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.