From: Ilias Lazaridis Date: 2011-06-16T02:50:44+09:00 Subject: CORE - Inconsistent Handling of Uninitialized Variables puts "\n== Testin in MAIN Context ==" local = 'local' @instance = 'instance' @@class = 'class' $global = 'global' puts "#@instance, #@@class, #$global, #{local}" begin puts $empty_global == nil rescue puts "undefined" end begin puts @empty_instance == nil rescue puts "undefined" end begin puts empty_local == nil rescue puts "undefined" end begin puts @@empty_class == nil rescue puts "undefined" end class VarTest puts "\n== Testin in Class Context ==" local = 'local' @instance = 'instance' @@class = 'class' $global = 'global' puts "#@instance, #@@class, #$global, #{local}" begin puts $empty_global == nil rescue puts "undefined" end begin puts @empty_instance == nil rescue puts "undefined" end begin puts empty_local == nil rescue puts "undefined" end begin puts @@empty_class == nil rescue puts "undefined" end end #OUTPUT == Testin in MAIN Context == instance, class, global, local true true undefined undefined == Testin in Class Context == instance, class, global, local true true undefined undefined - The inconsistency: become nil, do not raise error: $empty_global @empty_instance are undefined, raise an error: empty_local @@empty_class - Is this a defect or is there an explanation for this behaviour? . -- htttp://lazaridis.com