Eiffel Media API
Overview Cluster Class Classes Index      Previous Next      Top Features

kernel.spec.ise

Class KL_ANY_ROUTINES



Features

Invariants

indexing

description

Routines that ought to be in class ANY

library

Gobo Eiffel Kernel Library

copyright

Copyright (c) 2005, Eric Bezault and others

license

Eiffel Forum License v2 (see forum.txt)

date

$Date: 2005/06/04 19:52:33 $

revision

$Revision: 1.4 $

class

KL_ANY_ROUTINES

feature -- Status report

equal_objects (obj1, obj2: ANY): BOOLEAN

-- Are obj1 and obj2 considered equal?

ensure
same_types: Result and (obj1 /= Void and obj2 /= Void) implies same_types (obj1, obj2)
same_objects (obj1, obj2: ANY): BOOLEAN

-- Are obj1 and obj2 the same object?
-- Useful as a way to workaround VWEQ validity rule
-- (when running flat Degree 3 for example):
-- my_hashable := my_string
-- my_comparable := my_string
-- ANY_.same_objects (my_hashable, my_comparable)

ensure
definition: Result = (obj1 = obj2)
same_types (obj1, obj2: ANY): BOOLEAN

-- Is type of obj1 identical to type of obj2?

require
obj1_not_void: obj1 /= Void
obj2_not_void: obj2 /= Void

feature -- Conversion

to_any (an_any: ANY): ANY

-- Return an_any;
-- This can be used to workaround VWEQ validy rule:
-- my_hashable := my_string
-- my_comparable := my_string
-- ANY_.to_any (my_hashable) = ANY_.to_any (my_comparable)
-- This is also useful to workaround the validity rule
-- introduced by SE for assignment attempts whereby the type
-- of the target has to conform to the type of the source:
-- my_string ?= ANY_.to_any (my_storable)

ensure
definition: Result = an_any

invariant

-- From ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)

end