I was trying to fix the problem with wxImage and the char */unsigned char * thing today and I was going to hand-write the functions to translate between the two. While doing so I decided I''d clean up the SWIG error message to make it more clear. Here''s an example SWIG-generated argument error: in method SetData'', argument 2 of type ''wxImage *'' This seems to require a bit of knowledge about the wxWidgets library and C types. I thought it might be a bit clearer to change these to something like: in method ''set_data'', argument 1 expected ''Wx::Image'' (note argument errors are off by one since the calling object is argument 1) How do you feel about this?
Could we have the current way when building in debug mode and use the new version for release? Or possibly someway to enable the old behavior if it is needed for debugging. 99% of the time the new way is what I would want but the original may come in handy if you need to dive into the swig generated code. Also Roy you are doing a lot of good work lately keep it up! Thanks. Sean On 9/24/06, Roy Sutton <roys at mindspring.com> wrote:> I was trying to fix the problem with wxImage and the char */unsigned > char * thing today and I was going to hand-write the functions to > translate between the two. While doing so I decided I''d clean up the > SWIG error message to make it more clear. Here''s an example > SWIG-generated argument error: > > in method SetData'', argument 2 of type ''wxImage *'' > > This seems to require a bit of knowledge about the wxWidgets library and > C types. I thought it might be a bit clearer to change these to > something like: > > in method ''set_data'', argument 1 expected ''Wx::Image'' > > (note argument errors are off by one since the calling object is argument 1) > > How do you feel about this? > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users >
Sean Long wrote:> Could we have the current way when building in debug mode and use the > new version for release? Or possibly someway to enable the old > behavior if it is needed for debugging. > > 99% of the time the new way is what I would want but the original may > come in handy if you need to dive into the swig generated code. >Well, absolutely. I think we should do this in Ruby with fixmodule.rb and fixmainmodule.rb. In fact, anyone with some ruby experience should be able to whip this one up (hint hint). I won''t take a crack at this for a while so I''d be pleased to have someone beat me to it.> Also Roy you are doing a lot of good work lately keep it up! Thanks. >Shucks. Now if only I were making as much progress on the things I get paid for... Roy
Roy Sutton wrote:> in method SetData'', argument 2 of type ''wxImage *'' > > This seems to require a bit of knowledge about the wxWidgets library and > C types. I thought it might be a bit clearer to change these to > something like: > > in method ''set_data'', argument 1 expected ''Wx::Image''To borrow a convention from other lists[1], I think I am +0 on this. Sean raises an interesting idea (deciding what to display based on whether it is a debug build), but I don''t think I like that. I would prefer to keep it always one way or always the other. Since we are mangling the name, and since this is first an foremost a Ruby project with a Ruby audience, I don''t see a problem with providing the error message customized to a Ruby context. Assuming it''s fairly clean and simple to do so. Kevin [1] A means of succinctly "voting" on proposals: +1 = support +0 = slightly positive, but not full support -0 = slightly negative, but not opposed -1 = opposed
Roy Sutton wrote:> I thought it might be a bit clearer to change these to something like: > > in method ''set_data'', argument 1 expected ''Wx::Image'' >+1, prefer it to be standard across all builds Incidentally, I think SWIG should be raising a TypeError not an ArgumentError here: irb(main):001:0> ''abcdef''.index(:foo) TypeError: type mismatch: Symbol given from (irb):1:in `index'' from (irb):1 irb(main):002:0> ''abcdef''.index(4, 5, :foo) ArgumentError: wrong number of arguments (3 for 2) from (irb):2:in `index'' from (irb):2 alex