From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ac39a12d5faf5b14 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-04-24 12:14:26 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Grace and Maps (was Re: Development process in the Ada community) Date: Wed, 24 Apr 2002 14:14:34 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <3CB46975.90408@snafu.de> <3CBAFFEE.2080708@snafu.de> <4519e058.0204171036.6f0a7394@posting.google.com> <3CBDD795.4060706@snafu.de> <4519e058.0204180800.44fac012@posting.google.com> <3CBF0341.8020406@mail.com> <4519e058.0204190529.559a47ae@posting.google.com> <3CC1C6B3.6060306@telepath.com> <3CC21747.5000501@telepath.com> <4519e058.0204220534.2eb33730@posting.go <3CC48F34.5A474E0F@boeing.com> <3CC49C50.485AE213@san.rr.com> <3CC4B5C0.4D16077C@acm.org> <3CC4E9DA.E02BE0DA@san.rr.com> <7vznzukhzf.fsf@vlinux.voxelvision.no> <3CC5B161.C719C5D8@san.rr.com> <7vg01lwaku.fsf@vlinux.voxelvision.no> <3CC6B932.75C468E1@san.rr.com> <7vbsc9w367.fsf@vlinux.voxelvision.no> X-Newsreader: Microsoft Outlook Express 4.72.3612.1700 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3719.2500 X-Complaints-To: newsabuse@supernews.com Xref: archiver1.google.com comp.lang.ada:23074 Date: 2002-04-24T14:14:34-05:00 List-Id: Ole-Hjalmar Kristensen wrote in message <7vbsc9w367.fsf@vlinux.voxelvision.no>... >Darren New writes: >> how to do this in Ada, tho - it would seem that every private type >> (for example) would have to implement its own hash >> function. Wouldn't it? > >Hmm. What's wrong with having a generic hash function which you >instantiate for your private type? Provided that you can read the key >as an array of bytes, it should work the same in both C and Ada. I >know this is low-level and dirty, but for hashing, I think it's a >reasonable approach. Actually, it doesn't even need to be generic. It is easy to write a hashing algorithm that works with any type that can be streamed (use streaming operations to convert to an array of stream elements, hash that) -- I've seen two such implementations in the last few days. Using streams to do this has the advantage of eliminating packing and implementation-defined components from concern. It does limit the applicability of the package to non-limited keys, but that seems to be an acceptable limitation (do you really need to hash tasks??). Randy.