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

 
 

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

task #12085: clone() method

Submitter:  Mike Gerwitz <mikegerwitz>
Submitted:  Sat 09 Jun 2012 07:11:55 PM UTC
   
 
Should Start On:  Wed 01 Aug 2012 04:00:00 AM UTC Should be Finished on:  Sat 01 Sep 2012 04:00:00 AM UTC
Category:  Core Priority:  7 - High
Item Group:  Development Status:  None
Privacy:  Public Assigned to:  mikegerwitz
Percent Complete:  0% Open/Closed:  Open
Planned Release:  None
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>
Group administrator
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>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-05-20 mikegerwitz Planned Release0.2.0 None

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code