On Tuesday 30 November 2004 05:25 am, Brian Schröder wrote: | Sorry for the noise, I read the rejection further down only after sending | this. (Though I still think #to_scalar more natural than #one, because #one | does not convey a clear meaning to me) | | e.g. | | [].one => 1 (It returns one?) | [].one => true (It is only one array?) | [:a,:b,:c,:d].one => [1,1,1,1] (Fill with ones?) At first it occurred to me that this is nothing more than Array#first, except that an error is desired if it isn't single. But this led me to another oddity about #first, you can;t distinguish the results of these two forms: [].first [nil].first To improve upon this leads me to three possibilities: 1) Live with it. It's manegable. :) 2) Introduce the concept of nack --which is an encapsulated and diverted error. This has certain advantages, but it is a "bigger" change. [].first #=> nack (f = [].first).nack_raise #=> (Exception) where #nack_raise is defined in kernel to raise the nack if it is one other wise return self. 3) Add a parameter to #first. [].first(:empty) #=> (Exception) [1].first(:empty) #=> 1 [1,2].first(:empty) #=> 1 [].first(:only) #=> (Exception) [1].first(:only) #=> 1 [1,2].first(:only) #=> (Exception) T.