taskease.js - Tasks: task #12085, clone() method

 
 

You are not allowed to post comments on this tracker with your current authentification level.

task #12085: clone() method

Submitted by:  Mike Gerwitz <mikegerwitz>
Submitted on:  Sat 09 Jun 2012 07:11:55 PM UTC  
 
Should Start On: Wed 01 Aug 2012 04:00:00 AM UTCShould be Finished on: Sat 01 Sep 2012 04:00:00 AM UTC
Category: CorePriority: 7 - High
Item Group: DevelopmentStatus: None
Privacy: PublicAssigned to: Mike Gerwitz <mikegerwitz>
Percent Complete: 0%Open/Closed: Open
Planned Release: 0.2.0
Keywords: clone

Sat 09 Jun 2012 07:38:14 PM UTC, comment #1:
[Additional Information]

Another consideration is whether or not to support deep cloning in addition to the faster shallow clone, and whether or not to deep clone by default (which is certainly the safer option, albeit less performant).

Implementing a deep clone would not be overly difficult, as the ease.js util module already has a deep clone method.

Mike Gerwitz <mikegerwitz>
Project AdministratorIn charge of this item.
Sat 09 Jun 2012 07:11:55 PM UTC, original submission:

Cloning is conventionally done in JS by copying each property to a new object. There are a couple issues with that approach for cloning class instances in ease.js:

  • Cloning all class data will cause problems, such as the sharing of instance vars
  • Not all values are enumerable
  • Depending on environment, private and protected values are inaccessible (unless the class itself provides a clone operation).

Add a clone() method to support this operation. This method can be implemented directly on the class [and overridden by the class if so desired*].

  • Additional thought will be put into what should be permitted to be overridden for clone(). The initial implementation may be final, since this would not cause a BC break should that change in the future.
Mike Gerwitz <mikegerwitz>
Project AdministratorIn charge of this item.

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by mikegerwitz (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    No Changes Have Been Made to This Item

    Back to the top


    Powered by Savane 3.1-cleanup