Re: is_equal of HASHABLE

Dominique Colnet <[email protected]>
Newsgroups gmane.comp.lang.eiffel.smalleiffel
Message-ID <[email protected]>
Frank Boehme wrote:

> Yes, to me that looks more suitable for general purpose programs, i.e.
> where it is the intention just to make objects hashable.
> BTW, in my G2F3 code a more special situation arises since hundreds of
> thousands of game positions may be stored in the transposition table.
> Obviuously, I am concerned about memory usage which is why I store only
> that part of information which determines whether two positions are
> identical or different and who is to move next. This is what the feature
> {STORAGE_HASHABLE}.hash_key: HASH_KEY does. Now, in that (admittedly
> special) case, HASH_KEY key inherits only from HASHABLE and its
> attributes are only expanded types so that the built-in definition of
> is_equal will always do. But I agree that Dominque's suggestion (defer
> is_equal in HASHABLE and adding the psotcondition) is a good decision:
> It guarantees that the assumptions which are made in HASHED_SET and
> HASHED_DICTIONARY are checked by a contract and it does not impose much
> hassle. 
> cheers,
> Frank
Obviously, if some class as only one parent which is HASHABLE, it is 
possible
to get the ANY body by adding an extra INSERT ANY.
I have just applied the new definition on our working version.
Here is the commit message:
-----------------------------------------------------------------
Module name:	SmartEiffel
Repository:	SmartEiffel/tools/misc/
Changes by:	colnet	05/05/17 15:28:18
CVS server:	cvs-sop.inria.fr

Modified files:
	SmartEiffel/lib/abilities/: hashable.e
	SmartEiffel/lib/kernel/: hierarchic_graph_node.e
	SmartEiffel/lib/numeric/: integer_general.e
	                          mutable_big_integer.e number.e
	                          real_general.e
	SmartEiffel/lib/string/: character.e string.e unicode_string.e
	SmartEiffel/lib/time/: microsecond_time.e time.e
	SmartEiffel/tools/: class_name.e class_text.e feature_name.e
	                    hashed_string.e live_type.e
	SmartEiffel/tools/expression/: agent_creation.e
	                               manifest_generic.e
	                               manifest_string.e
	SmartEiffel/tools/feature/: native_plug_in.e
	SmartEiffel/tools/misc/: agent_args.e graph_node.e plugin.e

Log message:
	To follow the proposal of Frank Boehme ([email protected]) and
         the
	result of the recent discussion on our mailing list about the
	redefinition of `is_equal´ in HASHABLE. The new definition now
         has
	an extra "ensure then" assertion and is redefined as deferred !
	
	Actually, the modification of HASHABLE forced me to remove many
	"redefine is_equal" here and there (which is actually a good
         news).
-----------------------------------------------------------------
Except in case of bad surprise while running all tests, I think we won't
roll back. Good.
Thanks again,
-- 
--------------------------------------------------------------
[email protected] -- IUT (Nancy 2) -- INRIA Lorraine
http://SmartEiffel.loria.fr  --  The GNU Eiffel Compiler
POST: Loria, B.P. 239,54506 Vandoeuvre les Nancy Cedex, FRANCE
Voice:+33 0383913140 Mobile: +33 0665362381 Fax:+33 0383581701
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.