adds algebird-hash module, core depends on it. #138

Open
wants to merge 3 commits into
from

3 participants

@johnynek

This is API breaking, so it it is not a patch version bump when we publish next.

Count-min is still using it's own hash approach. I think we should revisit that, and we should also consider adding something Avi suggested: a HashFamily[T,R] object, which I guess has a Seq[Hashable[T,R]]. The apply on T can return Seq[R]. Comments?

@sritchie
Twitter, Inc. member

@johnynek, do you want to slate this for 0.3.0?

@johnynek johnynek commented on the diff Jan 27, 2014
...c/main/scala/com/twitter/algebird/hash/Hashable.scala
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+package com.twitter.algebird.hash
+
+import java.nio.{ByteBuffer, ByteOrder}
+import java.security.MessageDigest
+
+/** Type-class for generic hashing
+ */
+trait Hashable[-T,+R] extends (T => R) { self =>
@johnynek
johnynek added a line comment Jan 27, 2014

don't extend function, creates implicit conversions.

@johnynek
johnynek added a line comment Jan 27, 2014

self has caused issues with serialization. Be explicit with val self = this where needed.

@johnynek
johnynek added a line comment Jan 27, 2014

I think Hashable32, Hashable64, Hashable128 might be better approaches. There is a false generality here that blurs with Function in a non useful way. This trait is indistinguishable from Function, and that's silly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ianoc ianoc closed this Aug 4, 2015
@ianoc

Sorry my bad, git foo on cmd line broke stuff and closed all of these

@ianoc ianoc reopened this Aug 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment