[cdr-discuss] notes on CDR 2 - generic hash table

Gary King gwking at metabang.com
Thu Nov 23 01:11:23 UTC 2006


I sent this to Ingvar back in the day; since there is now a public  
process I thought I'd send it again "for the record"

Firstly, thanks for putting CDR 2 out there! (and thanks to powers  
behind the CDR process too).

A few comments:

1. typo in last paragraph of section 0.2.1: "possibel" -> "possible"

2. Naming. I like longer names (they are easier to read and  
completion makes them easier to type). I'd rather: I also like  
consistency and hate abbreviations (I can never remember which  
abbreviation to use <smile>). So I'd suggest:

hash-lookup
hash-delete
hash-empty!
hash-map
hash-count
hash-size
generic-hash-table-p

I like lookup because reference (and ref) seem unclear to me whereas  
lookup is what we're doing. I like delete rather than remove because  
delete in Common Lisp signifies that the function is destructive. I  
like empty! rather than clear (or clr) because the meaning of empty  
if more obvious (to me). The ! further signifies that something  
drastic is happening. I like hash-map, hash-count and hash-size over  
map-generic-hash, generic-hash-table-count and generic-hash-table- 
size because they are more consistent with the naming of the other  
functions and because they are also shorter to type).

FWIW, I'd rather that the hash-table argument went first in every  
function (I don't value consistency with the existing hash table  
implementation very highly). Lisp varies as to where is puts the   
"container" argument (nth versus elt versus aref... sigh) but here it  
is more likely that you are dispatching on the table and not the key  
and doing this would mean that every function had the table as it's  
second argument (I'd change hash-map too). (A big shout out to Chris  
Dean on this one!).

HTH, and thanks again,
--
Gary Warren King, metabang.com
Cell: (413) 885 9127
Fax: (206) 338-4052
gwkkwg on Skype * garethsan on AIM







More information about the cdr-discuss mailing list