Issue847

Title reduce boilerplate for hash functions
Priority feature Status unread
Superseder Nosy List jendrik, malte, silvan, thomas
Assigned To Keywords
Optional summary
TODO after finishing this issue: Send mail to downward-dev explaining the new 
hash functionality and how/when to use it.

Created on 2018-09-30.20:24:26 by jendrik, last changed by silvan.

Summary
TODO after finishing this issue: Send mail to downward-dev explaining the new 
hash functionality and how/when to use it.
Messages
msg7816 (view) Author: jendrik Date: 2018-09-30.20:24:25
Quoting Malte in msg7815:

[...] the amount of boilerplate we get because we currently have to implement
both a feed function and a hash method (because computing the hash method
requires access to the internals) is not good. We decided to go with a global
function because this gives more generality, but this function often refers to
an actual method to have access to private state. In the std library, this is
somewhat analogous to the role of the function std::begin vs. the begin methods
of many classes.

One idea, following the stdlib, is to have a default template implementation of
feed for typename T that delegates to a method T::feed_hash. Then implementors
only need to provide that method, and in the case of OperatorID, we could
directly feed the int.

We would then no longer implement any "hash()" methods for our classes or global
"feed()" functions, only the "feed_hash" methods, reducing boilerplate and
having more choice in which types to use.
History
Date User Action Args
2018-10-01 16:17:52silvansetnosy: + silvan
2018-10-01 11:58:19jendriksetsummary: TODO after finishing this issue: Send mail to downward-dev explaining the new hash functionality and how/when to use it.
2018-10-01 09:51:33thomassetnosy: + thomas
2018-09-30 20:24:26jendrikcreate