From: Jean Privat Date: Tue, 3 Mar 2015 15:04:56 +0000 (+0700) Subject: Merge: Introduce Cloneable interface X-Git-Tag: v0.7.3~44 X-Git-Url: http://nitlanguage.org Merge: Introduce Cloneable interface As exposed by #917 a standard API to clone objects could be useful. This PR propose a Cloneable interface that class can implement. The specif semantic of what a clone is is domain-dependent, the only suggestion I define is to be POLA and to consider the post condition `self == clone`. It seems sane since the precise semantic of `==` is also domain-dependent. The post-condition is not mandatory since not all classes redefines `==` and maybe some classes could be cloneable without being `==`-able. The reason is that `clone` is instantaneous but the semantic `==` should remain valid all the time. For instance, It could make sense to clone some Iterators but I am not sure what is a sane definition of `==` on them. As a POC, clone is implemented is the three Array-related classes, Array, ArraySet and ArrayMap. Pull-Request: #1176 Reviewed-by: Lucas Bajolet Reviewed-by: Alexandre Terrasa Reviewed-by: Alexis Laferrière --- 2ba3347fc2d3b590e96948d6443d1ab1f4f58677