From: Josef 'Jupp' Schugt Date: 2003-07-27T07:08:20+09:00 Subject: Re: Set doesn't have [] instance method Saluton! * Gavin Sinclair; 2003-07-26, 20:13 UTC: > It should, shouldn't it? It's meant to combine the fast lookup of > Hash with the convenience of Array, yet the most important method Hash > and Array have in common, Set lacks! > > $ irb > irb(main):001:0> require 'set' > => true > irb(main):002:0> s = Set[1,2,3] > => # > irb(main):003:0> s.include? 1 > => true > irb(main):004:0> s[1] > NoMethodError: undefined method `[]' for # > from (irb):4 > from :0 Ruby follows the principle of least surprise. Am I the only one to be stupefied if '[]' would exist for a set? Gis, Josef 'Jupp' Schugt -- N'attribuez jamais � la malice ce que l'incomp�tence explique ! -- Napol�on