lib/serialization: intro `is_same_serialized`
authorAlexis Laferrière <alexis.laf@xymus.net>
Sat, 16 May 2015 18:38:22 +0000 (14:38 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Mon, 18 May 2015 22:04:42 +0000 (18:04 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/serialization/serialization.nit

index aa8da21..2795d80 100644 (file)
@@ -141,6 +141,13 @@ interface Serializable
        init from_deserializer(deserializer: Deserializer) do end
 end
 
+redef interface Object
+       # Is `self` the same as `other` in a serialization context?
+       #
+       # Used to determine if an object has already been serialized.
+       fun is_same_serialized(other: nullable Object): Bool do return is_same_instance(other)
+end
+
 # Instances of this class are not delayed and instead serialized immediately
 # This applies mainly to `universal` types
 interface DirectSerializable