From: Daniel Berger Date: 2005-11-04T01:30:43+09:00 Subject: Question about NUM2LONG, symbols Hi all, The various NUM2x functions (NUM2LONG, NUM2INT, etc) include builtin type checks. However, they still seem to blindly accept symbols. Why? /* foo.c */ #include "ruby.h" #include static VALUE foo_test(VALUE self, VALUE num) { long x; x = NUM2LONG(num); printf("NUM: %ld\n", x); return Qnil; } void Init_foo(){ VALUE cFoo = rb_define_class("Foo", rb_cObject); rb_define_method(cFoo, "test", foo_test, 1); } # foo.rb require "foo" Foo.new.test("foo") # TypeError, expected Foo.new.test("foo".to_sym) # NUM: 10201 - yikes! Regards, Dan