[Rubycocoa-devel 232] Re: const_missing hook for function-styleconstants

アーカイブの一覧に戻る

Jonathan Paisley jp-ww****@dcs*****
Tue Mar 14 22:11:58 JST 2006


> I'm worry about compatibility of this change. The feature  
> const_missing
> is available on ruby-1.8.0 or later.
Do know how many RubyCocoa users are still using ruby 1.6?

> I think we can treat this symbols (NS...) as constants.
Looks reasonable. I got a runtime warning:

warning: rb_define_const: invalide name  
`_NSConstantStringClassReference' for constant

Small patch to only define constants with leading [A-Z]:

--- src/objc/cocoa/gen_cocoa_wrapper.rb (revision 61)
+++ src/objc/cocoa/gen_cocoa_wrapper.rb (local)
@@ -289,7 +289,7 @@
      ret_a.concat gen_def_c_func(info, 0)
      ret_b.concat gen_def_rb_mod_func(info, 0)
      unless /\Aconst NS\w+CallBacks\z/ =~ info.rettype #  
NSHashTableCallBacks...
-      ret_b.concat gen_def_rb_mod_const(info)
+      ret_b.concat gen_def_rb_mod_const(info) if info.name =~ /\A[A-Z]/
      end
    end
    $stderr.print " : #{$notimpl_cnt}/#{consts.size} consts NG"





More information about the Rubycocoa-devel mailing list
アーカイブの一覧に戻る