From: timsuth@... (Tim Sutherland) Date: 2002-06-08T08:56:58+09:00 Subject: Re: Struct :symbol vs 'string' difference In article <1023368547.798268.23822.nullmailer@picachu.netlab.jp>, Yukihiro Matsumoto wrote: >Hi, > >In message "Struct :symbol vs 'string' difference" > on 02/06/06, Tim Sutherland writes: >| >|ruby 1.6.6 (2001-12-26) [i586-linux] >| >|Bar = Struct.new('Bar', :a, :b, :c) >|Bar.new(1, 2, 3) -> # >| >|Foo = Struct.new(:Foo, :a, :b, :c) >|Foo.new(1, 2, 3) -> # >| >|I'm wondering why there is this difference, which I found surprising. > >If the first argument to the "new" is a string, it will be the name of >the Struct class (as in Struct::Bar). It's by the historical reason. >Ruby did not allow unnamed class before. Thanks for the explanation.