I had to patch responder2.rb and responder.rb to make Fox work on my
machine:responder2.rb:
36. @pseudoTarget = Fox::FXPseudoTarget.new
Yes, this one I'm OK with.
responder.rb:
7. include Fox
No; doing this would pollute the global namespace (more on that in a
moment). A better solution is to use the fully-qualified names for the
various Fox module-level methods and constants that the Responder module
methods need, e.g. this code:
# Define range of function types
def FXMAPTYPES(typelo, typehi, func)
addMapEntry(MKUINT(MINKEY, typelo),
MKUINT(MAXKEY, typehi),
func)
end
becomes:
# Define range of function types
def FXMAPTYPES(typelo, typehi, func)
addMapEntry(Fox::MKUINT(Fox::MINKEY, typelo),
Fox::MKUINT(Fox::MAXKEY, typehi),
func)
end
I did a little digging to try to understand why FXRuby worked the way it did
in version 1.0.13 and what changed in version 1.0.14, and I think it all
boils down to some changes made to 'responder2.rb'. For some time (i.e. at
least in version 1.0.13 and perhaps earlier) it has been true that when you
require the 'fox' feature:
require 'fox'
it was also requiring some of the FXRuby library modules, and in particular
it was doing:
require 'fox/responder2'
Now for FXRuby-1.0.13, the beginning of 'responder2.rb' looked like this:
require 'fox'
require 'fox/responder'
include Fox
and that last line was the culprit: it was dumping *everything* from the Fox
module into the global namespace, which kinda defeats the purpose of having
put those things into their own module in the first place. This code was
changed in version 1.0.14, where 'responder2.rb' no longer "include"-s the
Fox module into the global namespace.
So the behavior in FXRuby versions 1.0.14 (and later) is "safer" in the
sense that none of the stuff from the Fox module should ever escape into the
global namespace unless you explicitly make it so (i.e. by doing an 'include
Fox' at the top level). Since this is the behavior you were relying on, is
it possible to just modify the affected FreeRIDE file(s) to do an 'include
Fox' immediately after they require 'fox'? [I realize that I am asking this
question without knowing how many source files we're talking about.] Making
this change to the FreeRIDE sources would have the consequence that
everything from the Fox module will get dumped into the global namespace --
but that's what was happening *anyways* when you were running with FXRuby
1.0.13
···
On Wed, 13 Nov 2002 15:07:41 -0500, "Rich Kilmer" <rich@infoether.com> wrote :