We use an environment variable to control whether or not to enable a debug build of wxRuby. This was called simply DEBUG but I have renamed it to WXRUBY_DEBUG. I also added a second environment variable, WXRUBY_VERBOSE, which turns on extensive console output that can help debug memory problems. It prints a message any time an object is created, destroyed, etc. This used to only be an option in rakelinux.rb, but I have moved it to rakewx.rb. It is possible that my changes will cause errors on other platforms, notably VC++ on MSWin. If you build on other platforms, please let me know whether it still works, or if you have problems. Kevin
Kevin Smith wrote:> I also added a second environment variable, WXRUBY_VERBOSE, which turns > on extensive console output that can help debug memory problems. It > prints a message any time an object is created, destroyed, etc. This > used to only be an option in rakelinux.rb, but I have moved it to > rakewx.rb.Great, will give it a whirl. Does WXRUBY_VERBOSE require a debug build of WxWidgets? Also I think we still need to have an option to force a release build as I can''t see how to build one otherwise, and debug is buggy on OS X at least. Also, since we mentioned ruby style of conditional statements, can I suggest not using redundant parens in simple conditionals like: ''if($verbose_debug)''? A space seems nicer to separate the keyword. Similarly with puts. Otherwise, that combined with avoiding ''unless'' turns ''unless $foo'' into a punctuation car-crash: ''if(!$foo)'' which looks painfully C-ish/Perl-ish to me. :) alex
On Fri, 2006-08-25 at 20:29 +0100, Alex Fenton wrote:> Kevin Smith wrote: > Great, will give it a whirl. Does WXRUBY_VERBOSE require a debug build > of WxWidgets?> Also I think we still need to have an option to force a > release build as I can''t see how to build one otherwise, and debug is > buggy on OS X at least.I agree. But I believe the DEBUG version is behaving properly, and the release build is merely glossing over lots of errors.> Also, since we mentioned ruby style of conditional statements, can I > suggest not using redundant parens in simple conditionals like: > ''if($verbose_debug)''? A space seems nicer to separate the keyword. > Similarly with puts. > > Otherwise, that combined with avoiding ''unless'' turns ''unless $foo'' into > a punctuation car-crash: ''if(!$foo)'' which looks painfully > C-ish/Perl-ish to me.Oddly, I hate perl but don''t mind C++ that much. So my style tends to look a lot like C/C++/Java code. There is one somewhat compelling argument for putting parens in everywhere: Ruby sometimes gets confused without them. I forget what that case is, and instead of trying to remember it, I find it easier (and less ambiguous) to just always include parens if there are parameters. So my proposal would be that our coding standard call for parens everywhere except the empty case (). But I can be flexible if you or others really feel strongly about it. In the case you cite, would using "not" help you feel better about it? if(not $foo) Thanks, Kevin