From: Jean-Hugues ROBERT Date: 2002-05-02T03:49:34+09:00 Subject: Re: Auto-quoting simple hash keys? Hello, At 03:35 02/05/2002 +0900, Berger, Daniel wrote: >Hi all, > >What would people think of auto-quoting simple hash keys in Ruby (ala Perl)? > >i.e. hash[key] would be equivalent to hash['key'] > >Assuming this is possible (Matz), is it something people would be interested >in? That would basically mean that the "default" value for an un-initialized variable would be its string name. I feel that too often already I am loosing time simply because I spelled wrongly a variable's name... hash[:key] is not that much longer, is it ? Plus, Symbol are efficient. BTW: Optimization guess: cache the "hash code" of a String, when there is room for saving a Word, due to alignment of malloc() (that often alloc on 8 bytes boundaries, 16 on some architectures) (pad with zeros when cache is not set). Yours, Jean-Hugues ------------------------------------------------------------------------- Web: http://hdl.handle.net/1030.37/1.1 Phone: +33 (0) 4 92 27 74 17