Index: /cpp/frams/vm/classes/collectionobj.cpp
===================================================================
--- /cpp/frams/vm/classes/collectionobj.cpp	(revision 452)
+++ /cpp/frams/vm/classes/collectionobj.cpp	(revision 453)
@@ -15,5 +15,5 @@
 ParamEntry vector_paramtab[]=
 {
-{"Vector",1,13,"Vector","Vector is a 1-dimensional array indexed by an integer value (starting from 0). "
+{"Vector",1,14,"Vector","Vector is a 1-dimensional array indexed by an integer value (starting from 0). "
  "Multidimensional arrays can be simulated by putting other Vector objects into a Vector.\n"
 "Examples:\n"
@@ -39,6 +39,7 @@
 {"toString",0,PARAM_READONLY | PARAM_NOSTATIC,"Textual form","s",GETONLY(toString),},
 {"new",0,0,"Create new Vector","p oVector()",STATICPROCEDURE(p_new),},
-{"sort",0,PARAM_NOSTATIC,"Sort elements (in place)","p(o comparator)",PROCEDURE(p_sort),"comparator can be null, giving the \"natural\" sorting order (depending on element type), otherwise it must be a function reference obtained by the \"function FUNCTIONNAME\" operator.\n\nExample:\nfunction compareLastDigit(a,b) {return (a%10)<(b%10);}\nvar v=[16,23,35,42,54,61];\nv.sort(function compareLastDigit);"},
+{"sort",0,PARAM_NOSTATIC,"Sort elements (in place)","p(oFunctionReference comparator)",PROCEDURE(p_sort),"comparator can be null, giving the \"natural\" sorting order (depending on element type), otherwise it must be a function reference obtained from the 'function' operator.\n\nExample:\nfunction compareLastDigit(a,b) {return (a%10)<(b%10);}\nvar v=[16,23,35,42,54,61];\nv.sort(function compareLastDigit);"},
 {"iterator",0,PARAM_NOSTATIC | PARAM_READONLY,"Iterator","o",GETONLY(iterator),},
+{"clone",0,PARAM_NOSTATIC,"Create a clone","p oVector()",PROCEDURE(p_clone),"The resulting clone is a shallow copy (contains the same object references as the original). A deep copy can be obtained through serialization: String.deserialize(String.serialize(object));"},
 {0,0,0,},
 };
@@ -48,5 +49,5 @@
 ParamEntry dictionary_paramtab[]=
 {
-{"Dictionary",1,9,"Dictionary","Dictionary associates stored values with string keys "
+{"Dictionary",1,10,"Dictionary","Dictionary associates stored values with string keys "
  "(\"key\" is the first argument in get/set/remove functions). Integer key can be "
  "used to enumerate all elements (note that while iterating, the elements are returned in no particular order).\n"
@@ -74,4 +75,5 @@
 {"new",0,0,"Create a Dictionary","p oDictionary()",STATICPROCEDURE(p_new),"Empty directory can be also created using the {} expression."},
 {"toString",0,PARAM_READONLY | PARAM_NOSTATIC,"Textual form","s",GETONLY(toString),},
+{"clone",0,PARAM_NOSTATIC,"Create a clone","p oDictionary()",PROCEDURE(p_clone),"The resulting clone is a shallow copy (contains the same object references as the original). A deep copy can be obtained through serialization: String.deserialize(String.serialize(object));"},
 {0,0,0,},
 };
@@ -220,4 +222,17 @@
 	}
 ret->setInt(-1);
+}
+
+void VectorObject::p_clone(PARAMPROCARGS)
+{
+VectorObject *c=new VectorObject;
+c->data.setSize(data.size());
+for(int i=0;i<data.size();i++)
+	{
+	ExtValue *v=(ExtValue*)get(i);
+	if (v)
+		c->data.set(i,new ExtValue(*v));
+	}
+ret->setObject(ExtObject(&par,c));
 }
 
@@ -446,4 +461,15 @@
 }
 
+void DictionaryObject::p_clone(PARAMPROCARGS)
+{
+DictionaryObject *c=new DictionaryObject;
+for(HashEntryIterator it(hash);it.isValid();it++)
+	{
+	ExtValue *v=(ExtValue*)it->value;
+	c->hash.put(it->key,v?new ExtValue(*v):NULL);
+	}
+ret->setObject(ExtObject(&par,c));
+}
+
 DictionaryObject* DictionaryObject::fromObject(const ExtObject& o, bool warn)
 {
Index: /cpp/frams/vm/classes/collectionobj.h
===================================================================
--- /cpp/frams/vm/classes/collectionobj.h	(revision 452)
+++ /cpp/frams/vm/classes/collectionobj.h	(revision 453)
@@ -38,4 +38,5 @@
 PARAMGETDEF(toString);
 PARAMPROCDEF(p_sort);
+PARAMPROCDEF(p_clone);
 #undef STATRICKCLASS
 static void p_new(void*,ExtValue*args,ExtValue*ret)
@@ -70,4 +71,5 @@
 PARAMPROCDEF(p_find);
 PARAMGETDEF(toString);
+PARAMPROCDEF(p_clone);
 #undef STATRICKCLASS
 SString serialize() const;
