On Monday, November 29, 2004, 2:06:25 PM, James wrote:

> Gavin Sinclair wrote:
>> Hi all,
>> 
>> I'm preparing some methods for 'extensions' [1] and would like some
>> people's opinions on method names.
>> 
>>   Array#only
>>     [5].only      -> 5
>>     [1,2,3].only  -> exception
>> 
>>   

> What is 'only' supposed to do?

Return the _only_ element in an array.  If there's not exactly one,
then "only" doesn't make sense, so an exception is raised.  (At the
moment, the exception is RangeError, but I need to think about that.)

Gavin