nobu.nokada / softhome.net wrote: > Hi, > > At Fri, 4 Nov 2005 02:02:35 +0900, > Daniel Berger wrote in [ruby-talk:163946]: > > I guess it would be nice if we had a macro that raised a TypeError on anything > > except a Fixnum, Float or Bignum. Otherwise, aren't all C extension writers > > relegated to doing explicit checks against Symbols (the way rb_ary_ref() does > > in array.c) if we really want to make our code bulletproof? That, or lots of > > Check_Type() functions sprinkled throughout our code? > > An object has :to_int method should be treated as an Integer. > It's duck-typing, isn't it? Symbol no longer has that method > in 1.9. > > -- > Nobu Nakada I understand the duck typing approach. However, I'm curious why rb_ary_aref() explicitly forbids symbols as arguments. Can you tell me why? Was there some unexpected side effect? Thanks, Dan