On Wed, 21 Feb 2001, Kevin Smith wrote: > David Alan Black wrote: > > Enumerable#hashify(value) > > > >Description: > > > > Return a hash based on iterating through the receiver (an > > enumerable), either setting every value to the parameter "value" or > > setting the values via a block. > > Seems reasonable, but I wince every time I read > the word "hashify". I'm not even sure why. Could > you explain why to_h or to_hash would not be an > appropriate name? I steered away from to_h and to_hash partly because I felt that to do those names justice, they'd have to behave like to_s/to_str or to_a/to_ary. I wasn't sure what that would entail... and I didn't want the possibility of a simple E-to-H method to be delayed because of that. In addition to hashify, I had also considered "hash_with(value)", though I rejected that because it didn't sound right when doing the other thing you don't like, namely... > One other nit: I would prefer that it require > either a parameter or a block. Initializing all > the values to true doesn't seem helpful to me. ... calling it without an argument ("h = a.hash_with" looks weird). So "hashify" was an attempt to find a name that would make sense with or without an argument. As for nit #2: personally I like having it default to something. You can always send it a value anyway (i.e., the defaulting version is a superset of the non-defaulting version), and there's something nice, I find, about just being able to flip an array into a hash very concisely: h = a.hashify David -- David Alan Black home: dblack / candle.superlink.net work: blackdav / shu.edu Web: http://pirate.shu.edu/~blackdav