From: Tom Sawyer Date: 2002-08-04T03:05:49+09:00 Subject: Assoc Class (Hash Pairs) i've been thinking about posting this as an RCR. i would really like to see hash pairs (associations) become real objects. i think it would be a very powerful and useful construct. there are number of things one could then do. The simpliest obviosuly being: x = 'a'=>1 y = 'b'=>2 hash = { x, y } ordered hashes also become a snap, implemented as arrays of these associations: ordhash = [ x, y ] or, without the above x and y assignments, just ordhash = [ 'a'=>1 , 'b'=>2 ] this association class (Assoc?) would of course mixin the comparable module. the Assoc class becomes very useful when you start to build more comlex structures (what i would like to use it for): c = [ 'a'=>1, 's' ] this is a very simple example, but without the Assoc you'd have to write this as: c = { 'a'=>1, 's'=>nil } adding a useless nil, or c = [ ['a', 1], 's' ] whereby you have to use indexes on the association. i'm sure there are other uses as well, and i think it may be possible that such an Assoc class combined with arrays could ultimatly displace regular hashes altogether. -- ~transami