From: ayumix Date: 2001-08-01T06:56:17+09:00 Subject: [ruby-talk:18917] newbie autovivification Please make Perl autovivification possible in Ruby. foo[obj]="hello" (1) If foo is undefined, and if obj is not integer, Ruby will define foo as hash like foo={} (2) If foo is undefined, and if obj is integer, Ruby will ** assume ** foo is array, and will define foo as array like foo=[] If I want foo[5] to be hash, I have to declare foo explicitly foo={} foo[5]="hello" or do it differently foo[5.to_s]="hello" ########## Is it possible to add C style loop to Ruby? The following is from "Programming Ruby". def fibUpTo(max) i1, i2 = 1, 1 while i1 <= max yield i1 i1, i2 = i2, i1+i2 end end fibUpTo(1000) { |f| print f, " " } C style loop: def fibUpTo(max) for (i1, i2=1, 1; i1<=max; i1, i2=i2, i1+i2) yield i1 end end fibUpTo(1000) { |f| print f, " " } ########## Please add this cool Python stuff to Ruby. If 25 < foo < 75 : print "middle" It is also proposed for Perl6. Thanks for attention.